I want jQuery-Validation-Engine to not disappear when I click on the balloon display when an error occurs.

Asked 1 years ago, Updated 1 years ago, 127 views

We use a plug-in called jQuery-Validation-Engine for form validation.
When there is an error, a balloon appears and disappears when you click on the balloon.
Is there any way to keep it from disappearing even if I click this?

I read this, but I didn't understand it at all.

https://github.com/posabsolute/jQuery-Validation-Engine#options

Thank you for your cooperation.

jquery

2022-09-30 21:29

1 Answers

As far as the source code is concerned, there seems to be no branch that prevents the error prompt from disappearing when clicked.

/**
* Kind of the constructor, called before any action
* @param {Map} user options
*/
init:function(options){
    var form = this;
    if(!form.data('jqv')||form.data('jqv')==null){
        options=methods._saveOptions(form, options);
        // bind all formError elements to close on click
        $(document).on("click", ".formError", function(){
            $(this).fadeOut(150, function(){
                // remove prompt once invisible
                $(this).close('.formError') .remove();
            });
        });
    }
    return this;
},

https://github.com/posabsolute/jQuery-Validation-Engine/blob/master/js/jquery.validationEngine.js#L27

If you really want to keep the prompt from disappearing when you click, you may have to modify the local source code or submit such an option to your request.

If you modify the local source code and add the option (e.g.hideOnClick), would that be like this?

$(document).on("click", ".formError", function(){
            if(!options.hideOnClick)return;

            $(this).fadeOut(150, function(){
                // remove prompt once invisible
                $(this).close('.formError') .remove();
            });
        });


2022-09-30 21:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.