Note that there are some explanatory texts on larger screens.

plurals
  1. POTypeError: $.validator.methods[method] is undefined
    text
    copied!<p>I have some problem but I can't figure it out, I have see some examples and I have read few posts about this method, but still nothing.</p> <p>I get error:</p> <pre><code>TypeError: $.validator.methods[method] is undefined </code></pre> <p>And belove that is: </p> <pre><code>result = $.validator.methods[method].call( this, val, element, rule.parameters ) </code></pre> <p>That means that function doesn't have all parameters and that is what coused error.</p> <ol> <li>question: What is worng with validation?</li> <li>question: How to validate drop down list and radio buttons with jquery-validate lib?</li> <li>question: What would be the most elegant way to send data to some php script with method post.</li> </ol> <p>My JS code:</p> <pre><code>$("#userData").validate({ errorContainer: "#errorbox", errorLabelContainer: "#errorbox ul", wrapper: "li", rules: { first_name:{ require:true, minlength: 2, }, last_name: { required:true, minlength: 2, }, number_room: "required", email: { required:true, email:true, }, }, messages: { first_name:{ required: "Please enter name!", minlength: "At least 3 characters is needed for name", }, last_name:{ required: "Please enter surname!", minlength: "At least 3 characters is needed for surname", }, number_room: "Potrebno je izbrati sobo", email:{ required: "Please enter email!", email: "The format of email is: john.deer@gmail.com", } } }); </code></pre> <p>My html code:</p> <pre><code>&lt;form id="userData" name="userData" method="POST" action=""&gt; &lt;fieldset&gt; &lt;div id="errorbox"&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/div&gt; &lt;table width="450px"&gt; &lt;tr&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td valign="top"&gt;&lt;label for="cfirst_name"&gt;Name*&lt;/label&gt;&lt;/td&gt; &lt;td valign="top"&gt;&lt;input type="text" id="first_name" name="first_name" maxlength="50" size="30" class="required"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td valign="top"&gt;&lt;label for="clast_name"&gt;Surname *&lt;/label&gt;&lt;/td&gt; &lt;td valign="top"&gt;&lt;input type="text" id="last_name" name="last_name" maxlength="50" size="30" class="required"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td valign="top"&gt;&lt;label for="cnumber_room"&gt;Room number*&lt;/label&gt;&lt;/td&gt; &lt;td valign="top"&gt;&lt;select name="number_room" id="number_room" class="required"&gt; &lt;option selected value="0"&gt; Not choosen&lt;/option&gt; &lt;option value="1"&gt; 1 &lt;/option&gt; &lt;option value="2"&gt; 2 &lt;/option&gt; &lt;option value="3"&gt;3 &lt;/option&gt; &lt;option value="4"&gt; 4 &lt;/option&gt; &lt;option value="5"&gt; 5 &lt;/option&gt; &lt;option value="6"&gt; 6 &lt;/option&gt; &lt;option value="7"&gt; 7 &lt;/option&gt; &lt;option value="8"&gt; 8 &lt;/option&gt; &lt;option value="9"&gt; 9 &lt;/option&gt; &lt;option value="10"&gt; 10 &lt;/option&gt; &lt;option value="11"&gt; 11 &lt;/option&gt; &lt;option value="12"&gt; 12 &lt;/option&gt; &lt;option value="13"&gt; 13 &lt;/option&gt; &lt;option value="14"&gt; 14 &lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td valign="top"&gt;&lt;label for="cemail"&gt;Elektronski naslov *&lt;/label&gt;&lt;/td&gt; &lt;td valign="top"&gt;&lt;input type="text" id="email" name="email" maxlength="50" size="30" class="required" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2" style="text-align: center"&gt;&lt;input class="submit" type="submit" value="Sendi"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload