Form Validation Engine 1.6.4

by Cedric Dugas on March 29, 2010

Version 1.6.4 is now online. One major upgrade, you can now validate from any function in your script. You are no more bounded to the custom regex engine. And a minor update, you can now click on the bubble to make them disappear, in case they are in the way.

Here how it works:

In your field add:

  1. <input value=""  class="validate[required,funcCall[validate2fields]] text-input" type="text" id="lastname" name="lastname"  />

In your language js file have something like (nname is the function name to call):

  1. "validate2fields":{
  2.          "nname":"validate2fields",
  3.          "alertText":"* You must have a firstname and a lastname"}
  4.      }

Now the custom function that could be anywhere in your JS

  1.  function validate2fields(){
  2.    if($("#firstname").val() =="" || $("#lastname").val() == ""){
  3.     return true;
  4.    }else{
  5.     return false;
  6.    }
  7.   }

Grab it here.

19 comments

I like your script and started using it recently. Your new updates sound great…but I can’t seem to find where I can download v. 1.6.4. All I can find is still 1.6.3…

tarek
http://www.technotarek.com

by tarek on April 2, 2010 at 3:11 pm. Reply #

Great. I like that.
Can you let me know what could be the custom rule regex expression that I could add to the engine for “The field must contain at least an alphabet and a number.”
Thanks in advance.
Zullu.

by Zullu on April 6, 2010 at 3:00 pm. Reply #

Added range[min,max] for numbers:

“length”: {
“regex”: “none”,
“alertText”: “• Between “,
“alertText2″: ” and “,
“alertText3″: ” characters allowed”
},
“range”: {
“regex”: “none”,
“alertText”: “• Numeric value between “,
“alertText2″: ” and “,
“alertText3″: ” allowed”
},
“maxCheckbox”: {
“regex”: “none”,
“alertText”: “• Checks allowed Exceeded”
},

and

function _range(caller, rules, position) { // VALIDATE RANGE

customRule = rules[position];
startRange = eval(rules[position + 1]);
endRange = eval(rules[position + 2]);

pattern = eval(“/^[0-9\ ]+$/”);//$.validationEngine.settings.allrules[customRule].regex);

if (!pattern.test($(caller).attr(‘value’))) {
$.validationEngine.isError = true;
promptText += $.validationEngine.settings.allrules["range"].alertText + startRange + $.validationEngine.settings.allrules["range"].alertText2 + endRange + $.validationEngine.settings.allrules["range"].alertText3 + “”
}
else {
fieldValue = $(caller).attr(‘value’);

if (fieldValue endRange) {
$.validationEngine.isError = true;
promptText += $.validationEngine.settings.allrules["range"].alertText + startRange + $.validationEngine.settings.allrules["range"].alertText2 + endRange + $.validationEngine.settings.allrules["range"].alertText3 + “”
}
}
}


case “length”:
_length(caller, rules, i);
break;
case “range”:
_range(caller, rules, i);
break;

Hope this helps

by Rob Schoenaker on April 20, 2010 at 5:43 am. Reply #

Hi – I’m new to the jquery – so maybe this has already been answered… But how would I use your validation plugin in a ‘Tab’ UI?
I’m testing now and when I switch to different tabs – the validation messages don’t change?

Thanks

Paul

by Paul on April 22, 2010 at 6:06 pm. Reply #

rt

by tr on May 5, 2010 at 5:30 am. Reply #

Thanks for this great plugin!

Most of the time I have no problems. Unfortunately, I am now faced with a form that uses a regular button instead of a submit button. Is there a way to trigger the validation process without a submit button?

by intrepion on May 7, 2010 at 12:39 pm. Reply #

Nevermind, figured it out!

var valid = $(“#formID”).validationEngine({returnIsValid:true});

by intrepion on May 11, 2010 at 6:49 pm. Reply #

Awesome plugin!

Upon upgrading, I get this error in jquery.validationEngine.js:

$(this).find(“[class*=validate][type!=checkbox]“).live is not a function

Any ideas? Thanks much!

by Norm on May 20, 2010 at 2:37 pm. Reply #

Yes,

1.6.4 is only compatible with jquery 1.4 and up.

1.6.3 is still available for download

by Cedric Dugas on May 20, 2010 at 4:26 pm. Reply #

I have some problems in range function how can use it please help me as fast as possible

thanks for interest

by rizeq on June 10, 2010 at 3:56 am. Reply #

Hello Cedric Dugas
I am very happy to get such a great jquery validation but I could not able to valide dropdown list why ?
is there any problem way to validater dropdown list ?

Please give some advice to solve it

Again thanks for your such great validation

by Razer Maharjan on June 29, 2010 at 4:00 am. Reply #

I am trying to use your validation plugin along with a tabbing system I wrote, but I can’t get the tabbing to stop from going to the next step if there is an error generated from the form.

Any ideas on pointing me in the right direction for this?

by dennis on August 16, 2010 at 7:46 pm. Reply #

if form select disabled=true then no error. How to solve.

by RK on August 17, 2010 at 8:54 pm. Reply #

why here is not any validation for dropdownlist how to add can you please suggest?

by Mahendra on September 6, 2010 at 2:21 am. Reply #

Hi, Cedric Dugas

Can I use the funcCall for an extra use for add several parameters in the function,thanks.
such as

by Paul Li on October 27, 2010 at 3:46 am. Reply #

I want to create a generic method to validate URLs
can i pass a parameter (in my case i need the element ‘this’) from the class definition?
or i need to write a method to each url field i want to validate and get the field value using jquery?

Thanks

by Daniel on November 30, 2010 at 9:43 am. Reply #

Yes, I’d love to know if we can pass a value along in funcCall to determine what element was the trigger (having access to $(this) would be great).

Thanks,
Matt

by Matt on January 20, 2011 at 2:46 pm. Reply #

it works well in localhost but when run in the bowser it shows….validateEngine is not a function..How to fix it??

by kalaivani on July 25, 2011 at 11:24 pm. Reply #

sorry correction..NOT browser but when viewed online shows the error

by kalaivani on July 25, 2011 at 11:26 pm. Reply #

Leave your comment

Required.

Required. Not published.

If you have one.