I have run into another problem. I am using CakePHP and Cake renders
checkboxes as a hidden form element (for storing the value sent to the
server) and then the checkbox input.

Eg: <input type="hidden" name="data[User][tos]"  value="0" id="UserTos_" />
    <input type="checkbox" name="data[User][tos]" class="f-checkbox
{required:true}" value="1" id="UserTos" />


When refresh is run in validator it is selecting the hidden form element
first (because they share the same name), then that element is discarded
when the filter(":visible") is run. 

I had to change this line:
this.elements = jQuery(this.currentForm).find("input, select, textarea,
button").not(":submit").not(":reset").filter(function() {

to this:
this.elements = jQuery(this.currentForm).find("input, select, textarea,
button").not(":submit").not(":reset").not(":hidden").filter(function() {

to make it work. Is there a better way to accomplish this without modifying
the source code or could you add the change? Thank you for all of your help
with this, I really appreciate all of your work.

Regards,

Ryan Rose
Vice President
Digiwize, Inc.
One Technology Drive
Tolland, CT 06084
e: [EMAIL PROTECTED]
p: 860.730.2631
http://www.digiwize.com


-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jörn Zaefferer
Sent: Wednesday, May 23, 2007 4:53 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Validation Plugin validates hidden form fields


Ryan Rose wrote:
>
> Jörn,
>
> How can I force the new validation plugin to ignore form elements with 
> display: none?
>
>  
>
> I modified the previous release this way:
>
> validator.elements = 
> this.find(":input:not(:submit):not(:reset):visible").focus(function() {
>
> validator.lastActive = this;
>
> });
>
Try this, less obtrusive:

var validator = $("#myform").validate();
validator.elements = validator.elements.filter(":visible");

No need to modify the plugin file itself. Please let me know if that 
works for you.

-- 
Jörn Zaefferer

http://bassistance.de


Reply via email to