We help IT Professionals succeed at work.

jQuery Validation.js error

Robert Granlund
If you go to my page:
Go to the bottom and click add to cart.  You will see a few Javascript Validation warnings popup on the page.  The problem is, if you click in other fields, it causes the warning to reappear multiple times.  That is not the way the documentation says it should work. I can't figure it out.  Thanks in advance.
Watch Question

Top Expert 2015

Hard to say, but the combination of the php errors, javascript syntax errors, and the HTML tag nesting errors could be a contributing factor.


Would you be so kind as to point out a few examples of these so I know ezactly what you mean.  I'm still a newbie!
Top Expert 2015
Sure. If you look at the source of the rendered page, you have fourteen PHP errors that look like this example:

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:  Undefined variable: liability_25</p>
<p>Filename: libraries/Functions.php(688) : eval()'d code</p>
<p>Line Number: 408</p>

For the javascript, you have multiple syntax errors because of nested double quotes like this line:

vehicle_rate = "<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"></div>";

They can be easily fixed by using a single quote on the outside of the string:

vehicle_rate = '<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"></div>';

Since all of the PHP errors appear after the javascript syntax problem, fixing the javascript may eliminate the PHP errors.

HTML tag errors: If you use Firefox to view the source of the page, the improper tags show up in red:
Red tags in FirefoxThe screen shot points out a few problems.
1.) The <div> tags around the first option.
2.) The name attribute in the <option> tag is not valid.
3.) The name attribute value has no space after it.