Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery.ValidationEngine - removing error popups

Does anyone know how I can remove all created errors by the ValidationEngine with one command? I added the snippet of code that the plugin seems to use to create the popups. If you need any more information, please let me know.

The following code creates the errors:

buildPrompt : function(caller,promptText,type,ajaxed) {         // ERROR PROMPT CREATION AND DISPLAY WHEN AN ERROR OCCUR

        if(!$.validationEngine.settings){

            $.validationEngine.defaultSetting()

        }

        deleteItself = "." + $(caller).attr("id") + "formError"



        if($(deleteItself)[0]){

            $(deleteItself).stop();

            $(deleteItself).remove();

        }

        var divFormError = document.createElement('div');

        var formErrorContent = document.createElement('div');

        linkTofield = $.validationEngine.linkTofield(caller)

        $(divFormError).addClass("formError")



        if(type == "pass") $(divFormError).addClass("greenPopup")

        if(type == "load") $(divFormError).addClass("blackPopup")

        if(ajaxed) $(divFormError).addClass("ajaxed")



        $(divFormError).addClass(linkTofield);

        $(formErrorContent).addClass("formErrorContent");

Source code: http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/

Problem: When the user has errors on his screen and clicks a link that scrolls to another part of the page, the errors remain on an absolute position.

What I am looking for: a function that removes ALL errorç messages, there could be more than one.

like image 482
Aeonius Avatar asked Jun 20 '11 20:06

Aeonius


2 Answers

It has also a predefined function in validation engine.

$('#formID1').validationEngine('hideAll');
like image 123
Barış Velioğlu Avatar answered Oct 26 '22 03:10

Barış Velioğlu


function removeError(){$(".formError").remove()};

It's so simple... why it took me forever to get it is beyond me. Removing eerything with the .formError class kills all popups.

like image 22
Aeonius Avatar answered Oct 26 '22 02:10

Aeonius