Ryan Rose wrote:
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.
The problem with adding not(":hidden") is that someone may want to validate a few elements only when something else has happended. Eg. an input is hidden until a certain checkbox is clicked. By filtering out hidden inputs, that input won't be validated without a refresh. How about filtering out specifically only type hidden? ":hidden" matches both inputs of type hidden and other elements with "display: none". .not("[EMAIL PROTECTED]") should do the trick, I don't think there is a case where you want to validate a hidden input, is there?

--
Jörn Zaefferer

http://bassistance.de

Reply via email to