Sickaaron
Sickaaron

Reputation: 448

JQuery Validation Not Working

I am using the same code for my contact us form, and trying to apply it to a quote form as well. I have duplicated the code, and added the data for AJAX. But it just does nothing, no errors at all, the form does submit. I am trying to test it by just clicking on the submit button i should get validation errors ie please enter in the information.

This works fine on my contact us form, i cannot find the issue!

http://www.aklogistics.co.uk/quote-cheap-man-and-van-hire-london.html

The JQuery code is in this file: http://www.aklogistics.co.uk/js/views/view.contact.js

Upvotes: 0

Views: 2703

Answers (2)

Justin
Justin

Reputation: 594

I ran in to this issue with .NET MVC Razor. I found that I needed to add the id in the Razor @Html.CheckBox() helper:

    @Html.CheckBox("CheckBoxGroup", htmlAttributes: new { name = "CheckBoxGroup", id = "CheckBoxGroupItem1" })
    @Html.CheckBox("CheckBoxGroup", htmlAttributes: new { name = "CheckBoxGroup", id = "CheckBoxGroupItem2" })

Upvotes: 0

Mohd Asim Suhail
Mohd Asim Suhail

Reputation: 2292

<input type="checkbox" required="" aria-required="true"> this checkbox in 'Get Quote' page is not having any id and name, so jquery-validation is not able to reference it, that is why it is returning type undefined. Replace this checckbox with <input type="checkbox" name="agree" id="agree" required="" aria-required="true" class="error">

After a long debugging I found out this, give an id and name to your checkbox and validation will work accordingly.

Upvotes: 7

Related Questions