0

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

3
  • There seems to be a problem with jquery.validation library, console returns jquery.validation.min.js:9 Uncaught TypeError: Cannot read property 'type' of undefined at a.validator.elementValue (jquery.validation.min.js:9) at a.validator.check (jquery.validation.min.js:9) at a.validator.checkForm (jquery.validation.min.js:9) at a.validator.form (jquery.validation.min.js:9) at HTMLFormElement.<anonymous> (jquery.validation.min.js:9) at HTMLFormElement.dispatch (jquery.min.js:3) at HTMLFormElement.q.handle (jquery.min.js:3) use updated jquery.validation js Commented Feb 12, 2017 at 19:39
  • i downloaded the latests validation js file and replaced it, but it's still the same. What's confusing is, why does it work fine for the contact us page, but not this page - its the same code! Only difference is the ajax data. Commented Feb 12, 2017 at 20:06
  • Found the solution Commented Feb 12, 2017 at 20:38

2 Answers 2

7

<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.

Sign up to request clarification or add additional context in comments.

1 Comment

Not all heroes wear capes 🙌
0

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" })

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.