Giter Site home page Giter Site logo

Tooltip hover behaviours about xtform HOT 4 OPEN

refactorthis avatar refactorthis commented on June 16, 2024
Tooltip hover behaviours

from xtform.

Comments (4)

refactorthis avatar refactorthis commented on June 16, 2024

@ReinierGielen

from xtform.

ReinierGielen avatar ReinierGielen commented on June 16, 2024

If I understand this solution correctly the attribute tooltipTrigger is added to the form and it has the same options as the bootstrap tooltip and your code passes this through so the programmer can set the tooltiptrigger for each form seperatly.

Sounds great.

from xtform.

ReinierGielen avatar ReinierGielen commented on June 16, 2024

Great stuff on the hover option for the tooltips, works really nice.
A minor bug I found was that when an error is resolved by the user the tooltip is hidden but it reapears when hovered again. I solved this by replacing 'hide' by 'destroy'.
Also I wanted a css handle for styling the element when the tooltip is placed on an alternative element.
This handle must remain as long as there is an error. I solved it by adding an extra class to the element which is removed when the number of errors is 0.
This resulted in this code:
function redrawErrors() {

            if (attrs.xtValidationTooltip != ""){
                element.addClass('xt-invalid');
            }

            if (ngModel.$xtErrors.length === 0 ) {
                element.removeClass('xt-invalid');
                lastErrors = null;
                element.tooltip('destroy');
                return;
            }

Now I have only 1 bug left that I have not solved yet.
When I have input fields in error with hover tooltips and I reset my form the tooltips are not destroyed and can re-appear when it is not appropriate.

Hope this stuff is usefull. If I find a solution for this last bug I'll post it here.

from xtform.

ReinierGielen avatar ReinierGielen commented on June 16, 2024

I change the type of my reset button to "reset" and now I actually get in the reset branch in xtForm.
The I do however get a function is undefined on vm.form.$setUntouched
After some googeling and debugging I found out that $setUntouched is not a function of a form, but a function of each form control.
Removing this line of code seem to have no effect on the workings except ther is no javascript error anymore.

Please correct me if I have drawn the wrong conclusion.

However this does not solve my problem, I still need a way to remove all validation tooltips from the form elements on reset.

from xtform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.