5

I prefer Jquery ValidationEngine over Bassistance validation. my question is

We do not use one input per line, some of them are in the same line like First Name: [] Last Name: []

When errors popup, the error messages overlap and they look so ugly.

Can I do something to validation engine, that it shows only First most error and when the error is fixed and user tries to submit form the other first most error (if exists) will show there.

real life example:- For example First name and last name both are REQUIRED and both fields are empty user tries to submit but he sees only one error on First Name, he types his first name as "Asif" , then he tries to submit now he sees second error on Last Name field he input last name "Ashraf" and then the form is good to go.

Can we achieve that?

j0k
  • 22,600
  • 28
  • 79
  • 90
Asif Ashraf
  • 665
  • 1
  • 7
  • 15

6 Answers6

5

try changing

showOneMessage true

Bharadwaj
  • 51
  • 1
  • 2
  • a mixture of both do work.. if ($('form.wpcf7-form').length) { $.validationEngine.defaults.scroll = true; $.validationEngine.defaults.autoHidePrompt = true; $.validationEngine.defaults.autoHideDelay = 5000; $.validationEngine.defaults.showArrow = true; $.validationEngine.defaults.autoPositionUpdate= true; $.validationEngine.defaults.maxErrorsPerField= true; $.validationEngine.defaults.showOneMessage= true; $('form.wpcf7-form').validationEngine(); – Jean G.T Nov 06 '19 at 17:15
3

If we have to show one error at a time per field field then we will use

maxErrorsPerField:1

It will be like

$("#form_id").validationEngine('attach', { maxErrorsPerField:1});
Amit Garg
  • 3,867
  • 1
  • 27
  • 37
1

Try this:

<input value="" class="validate[required]" type="text" name="FirstName" id="fname">
<input class="validate[condRequired[fname]]" type="text" name="LastName" id="lname">
Hulk1991
  • 3,079
  • 13
  • 31
  • 46
0

I believe the option you are looking for is:

// Used when you have a form fields too close and the errors messages are on top of other disturbing viewing messages doNotShowAllErrosOnSubmit: false

Olivier Refalo
  • 50,287
  • 22
  • 91
  • 122
0

try this:

showErrors: function(errorMap, errorList) {
    this.defaultShowErrors();
    $("#changepass label.error:visible").each(function(index,value){
        if(index)
            $(this).hide();
    });
},
onkeyup: false,
onclick: false,
onfocusout: false
Nitin
  • 49
  • 3
0

set maxErrorsPerField property to true

    $("#formid").vaidationEngine({ maxErrorsPerField:true});