[jQuery] Validate plugin - help with name vs Id for rules; checkbox in strange format
hi
first, I want to say how cool this validation plugin is, very slick -
especially like the eager validation aspect.
I use CakePHP, and I am trying to check a "terms" box is checked, but
CakePHP outputs the HTML like so:
<div class="input checkbox">
<input id="CoverAgreed_" type="hidden" value="0" name="data[Cover]
[agreed]"/>
<input id="CoverAgreed" type="checkbox" value="1" name="data[Cover]
[agreed]"/>
<label for="CoverAgreed">do you agree to the terms?</label>
</div>
because of the names being identical, I have had difficulty getting
Validate to work and check that this second field is required. I know
it is not possible to use ID in rules: option of validate method. But
setting
rules: {
"data[Cover][agreed]" : { required:true } will not work for me.
I have tried a workaround addressing the $(#CoverAgreed) . validate()
but could not be successful either. Any ideas for a workaround?
thank you in advance for any help you may be able to give
Luke