Aeonius
Aeonius

Reputation: 1073

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.

Upvotes: 8

Views: 10103

Answers (3)

I am using something like this css

.formError{
-moz-animation: cssAnimation 0s ease-in 3s forwards;
/* Firefox */
-webkit-animation: cssAnimation 0s ease-in 3s forwards;
/* Safari and Chrome */
-o-animation: cssAnimation 0s ease-in 3s forwards;
/* Opera */
animation: cssAnimation 0s ease-in 3s forwards;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;}

@keyframes cssAnimation {
to {
    width:0;
    height:0;
    overflow:hidden;
}}

@-webkit-keyframes cssAnimation {
to {
    width:0;
    height:0;
    visibility:hidden;
}}

than i am adding this JS

jQuery(document).on('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', '.formError', function (e) {
        e.target.remove();
    });

Upvotes: 0

Barış Velioğlu
Barış Velioğlu

Reputation: 5827

It has also a predefined function in validation engine.

$('#formID1').validationEngine('hideAll');

Upvotes: 11

Aeonius
Aeonius

Reputation: 1073

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.

Upvotes: 5

Related Questions