[jQuery] (validate) validator is undefined error
I'm trying to implement Validate on a survey form that has just a few
basic requirements. I'm running jQuery 1.3.2 and Validate 1.5.5.
Whenever I try to run the code, however, I get an error that
"validator is undefined". I tried Googling and found only a few hits,
most saying the HTML was invalid. Checked that, corrected a few minor
errors, but still getting the error. In addition to the code below, I
tried just the basic $("#surveyForm").validate() but it still gives
the same error. This is on a development application, so it isn't
available online yet.
Summer
~~~~SNIPPET FROM JS FILE~~~~
var validator = $("#surveyForm").validate({
rules: {
recommend: "required",
howlearnedother: {
required: function(element) {
return $('#howlearned input[name=howlearned]:checked').val() == 0;
}
},
describeyouother: {
required: function(element) {
return $('#describeyouother input
[name=describeyouother]:checked').val() == 0;
}
}
},
messages: {
recommend: "Please indicate if you would recommend the SRAC site to
others",
howlearnedother: "Please indicate how you learned about SRAC's
publications.",
describeyouother: "Please indicate your industry."
}
});
~~~SNIPPET OF HTML FORM~~~~
<form action="?event=submitSurvey" method="post">
<fieldset id="surveyForm">
<legend>Please complete this survey to help us improve our
offerings:</legend>
<label for="recommend">What is the likelihood that you would
recommend the SRAC web site or its publications to your family and
friends? Choose one number below with 1 = not likely and 10 = highly
likely.</label>
<div id="recommend">
<input name="recommend" type="radio" value="1" /> 1
<input name="recommend" type="radio" value="2" /> 2
<input name="recommend" type="radio" value="3" /> 3
<input name="recommend" type="radio" value="4" /> 4
<input name="recommend" type="radio" value="5" /> 5
<input name="recommend" type="radio" value="6" /> 6
<input name="recommend" type="radio" value="7" /> 7
<input name="recommend" type="radio" value="8" /> 8
<input name="recommend" type="radio" value="9" /> 9
<input name="recommend" type="radio" value="10" /> 10
</div>
<label for="howlearned">How did you learn about SRAC publications?
</label>
<div id="howlearned">
<input name="howlearned" type="radio" class="checksandradios"
value="1" /> Linked from another web site<br />
<input name="howlearned" type="radio" class="checksandradios"
value="2" /> Search engine<br />
<input name="howlearned" type="radio" class="checksandradios"
value="3" /> Professional (e.g. Fisheries/aquaculture biologists)<br /