21489 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 282 Views |
-
jquery validate failing...

29 September 2011 at 9:01pm
Hi,
I've followed the details here: http://www.ssbits.com/tutorials/2009/using-jquery-for-form-validation/
but my form is being submitted no matter what I choose...unfortunately the default validation doesn't seem to work with tick boxes, so i'm having to cancel that and use a custom script
the page is live here: http://gvnpods.org/become-a-member/signup
can anyone see anything that might be stopping my jquery validation working?
Cheers
-
Re: jquery validate failing...

29 September 2011 at 11:16pm
I think you should use the fieldname to define rules and messages, instead of the the field id:
jQuery("#Form_SignupForm").validate({
rules: {
Form_SignupForm_Email: { required: true, email: true },
Form_SignupForm_LastName: { required: true },
...becomes
jQuery("#Form_SignupForm").validate({
rules: {
Email: { required: true, email: true },
LastName: { required: true },
...Hope that helps...
-
Re: jquery validate failing...

29 September 2011 at 11:38pm
Thanks, I'll give that a try tomorrow - late now!
in the mean time I went back to the standard validation script and added this
jQuery("#Form_SignupForm_TC").click(function(){
// If checked
if (jQuery("#Form_SignupForm_TC").is(":checked")){
jQuery("#Form_SignupForm_Terms").val("yes")
}else{
Query("#Form_SignupForm_Terms").val("")
}this crudely gets around the tick box issue by setting a value to a hidden field. silverstripe vaidlates the hidden field instead of the tickbox. the problem is that when you submit the form, you get the error messages. when you tick the box to correct the issue, the error message isn't being removed - it must be getting triggered by onkeydown or somthing...
| 282 Views | ||
|
Page:
1
|
Go to Top |

