I suppose that you need a custom rule due to validation plugin don't support relations
between fields.

With jQuery.YAV (http://jquery.com/plugins/project/jquery_yav) I can do:

<input id="t1" name="t1" type="text" class="equal" alt="{params:'some_value', require: 'pre-condition', condition: {name:'mycond', type:'implies', id:'t2', msg:'Please this field if required if you write a t1 value'}}" /> <input id="t2" name="t2" type="text" class="required" alt="{require:'post-condition',condition:{name:'mycond'}}"/>

And My JS code:

$("#theform").yav();

Example (write "some_value" in the first field):
http://projects.sevir.org/storage/yav/implies.html

I like validation plugin but I want better more complexes rules of jQuery.YAV :-)

howa escribió:
Hello, anyone has idea how to do dynamic form validation?

e.g. using http://bassistance.de/jquery-plugins/jquery-plugin-validation/


<input name="t1" type="text" />
<input name="t2" type="text" />


I only want to check for required field for t2 ONLY if t1 is equal to
some value

e.g.

If t1 = "test", then t2 cannot be null, else never mind abt t2

has any idea?




--
Best Regards,
José Francisco Rives Lirola <sevir1ATgmail.com>

SeViR CW · Computer Design
http://www.sevir.org
Murcia - Spain

Reply via email to