Form validation engine 2.0 is live

by Cedric Dugas on January 17, 2011

As said previously a rewrite of the validation engine has been in the work for sometimes and today it is finally live, the API changed a lot, might be a good idea to have a look at the new documentation if you are upgrading.

I will be updating the documentation today, but the most up to date doc will always be the readme on github. The legacy 1.7 documentation and download can be found under package when you hit download on github

Time to stop squeezing ketchup (inside joke) and hail to the beast.



22 comments

Awesome!!! Thanks for the awesome validation tools! Cheers!

by Oliver on January 18, 2011 at 11:08 am. #

Hello Cedric,

I don’y know if you speak french, so I’m gonna try with my poor english

You have many orthographical mistakes in the french js.

I corrected them, where should I send the corrected file ?

by Stephane on January 18, 2011 at 11:14 am. #

>>> Never mind, I found your email, and I just sent it 2U

Tnx for your nice work

by Stephane on January 18, 2011 at 11:17 am. #

It looks like you don’t use standard html5 attributes like requied :-(
Is it possible to add support for it?

by Petr on January 19, 2011 at 9:56 am. #

Hello,
Can I use this script in my commercial project ?
I will do not remove any lines from script!
Thanks.

by Jack on January 19, 2011 at 11:35 am. #

Jack, the project is free, for whatever you want to do with it

@Petr It could be moved there, but not for now

by Cedric Dugas on January 19, 2011 at 3:17 pm. #

Hi,
great new version !
However, how to validate a form cut under “tabs” ?
Each tab contains a part of the form with fields but only one tab is displayed at a time, while other parts are hidden with css style.
When using validate, only fields which are displayed are validated, others “css hidden” fields are not validated.

Thanks a lot for your Job !

by Aurel on January 20, 2011 at 5:12 am. #

Great to find it’s been upgraded. It’s so nice ..
I would like to know how to stop form submission after validation. Just like click submit, it validates the form, but not submits the form, appreciate if anyone would help.

by Frank Lahg on January 20, 2011 at 7:30 pm. #

@Frak you can use onValidationComplete

by Cedric Dugas on January 20, 2011 at 8:49 pm. #

:) , thank you.. I just figured it out.
My logic was:
first: validate the form values; then if( $(‘#formID’).validationEngine(‘validate’) == true), then submit the form values to another php file to process via POST method. and now, it’s just working as I expected. very nice and thank you.

But when I was still cheering for what I’ve done, another problem just started bothering me. The scenario is like I would like to validate a field which is gonna have an email address, and then ajax it with database. After I spent some time on reading all API documentations and the sample source codes, I decided to use codes like following:

$(document).ready(function(){
// turn ajax form on, and bind #formID to validationEngine;
$(“#formID”).validationEngine({ ajaxFormValidation: true, });
$(“#formID”).validationEngine();
});

then in the form code, I wrote it like:

but it doesnt work, and even nothing logged in java console (i’m using firebugs). then I tested validate options one by one, and I found when I use ajax only which means without ‘required’ and ‘custom’ fields, it actually works.

I looked into the validationEngine.js code, but I’m really js newbie and got no luck. Do you have another suggestions please? thanks in advance…

by Frank Lagh on January 21, 2011 at 7:54 am. #

oh, well, the code was filtered..let me simpy omit some tags.
(input class=”validate[required, custom[email], ajax[ajaxUserCall]] text-input” type=”text” id=”user_email_user” name=”user_email_user” value=”")

by Frank Lagh on January 21, 2011 at 7:57 am. #

Great validation script.

One small issue, the email validation does not seem to work on the iPad or iPhone (Safari). It marks up correct email addresses as “Invalid email address”. Any ideas on how to fix this?

Thanks.

by Robert Chambers on January 21, 2011 at 9:04 am. #

This issue seems related to the email validation regular expression. When I use my own custom function and regular expression it works fine on the iPhone and iPad.

The regular expression I’m using for email validation:
/^([A-Za-z0-9_\-\.\'])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,6})$/

by Robert Chambers on January 24, 2011 at 3:43 am. #

I’m sorry, but I think finally I got the reason why I thought it didnt work.

input class=”validate[required, custom[email], ajax[ajaxUserCall]] text-input” type=”text” id=”userEmail” name=”userEmail” value=””

It seems that any error messages about custom[email] will not show up uless you submit the form. I’m just used to the previous version of validationEngine, and was curious why it didnt work, :)

Again, thank you for you reply, and it’s really sweeet project.

by Frank Lagh on January 21, 2011 at 12:38 pm. #

What versions of jQuery are the validation engine compatible with? Will it work with jQuery 1.3?

I know 1.4 is a vast improvement on 1.3, but a large number of Drupal 6.x contrib modules are not compatible with 1.4, so we’re stuck with 1.3 for the time being.

Regards

by Jesper Wøldiche on January 22, 2011 at 2:27 pm. #

hello,

i have a question about validation with a custom Func:

I have 3 inputs but only one of them is required.

this rules are only called when i enter a value into the input?… not good…

Second try:

this rule is excuted every time I validate the form. It doesn’t matter if one of the other inputs has a value.

Any idea?

tr.matic

by traedamatic on January 24, 2011 at 5:46 am. #

@ jesper, it will not work with 1.3 from what I know, I had a 1.3 package but unfortunately I do not support it anymore

@traedamatic we currently have a bug with non required input

@Frank will have a look, ajax had a rewrite

@Robert thank, will change the regex

by Cedric Dugas on January 24, 2011 at 9:06 am. #

No problem Cedric. I think it was related to the previous email regex not allowing uppercase letters, but the iPhone and iPad default to making the first letter uppercase.

Thanks for a great validation tool.

by Robert Chambers on January 25, 2011 at 3:29 am. #

@Frank I am working on doing some example for the ajax form validation

by Cedric Dugas on January 24, 2011 at 9:15 am. #

Your validation is great and has a nice unobtrusive UI. However it would be nice to be able to create validatable fields in javascript.

Currently on form.validationEngine(‘attach’); the code binds all the blur events to validate the form. I have parts of the from that gets dynamically added after the page load. It would be nice to be able to attach the validation function to those dynamically created field too.

by Michael Charkin on January 24, 2011 at 8:08 pm. #

Is it possible to change a field CSS style when an error is detected ?

by Olivier Pierre on January 25, 2011 at 8:19 am. #

This is a very nice validation tool. Thank you.

I’m new to jquery and have a question. I have a form with two submit buttons. The first continues to the next question, the second to the previous. I would like to turn of validation when I go to the previous question. How do I do that?

by Jan Nielsen on January 25, 2011 at 8:26 am. #