Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting Duplicate Error Messages with JQuery Validation Plugin
    primarykey
    data
    text
    <p>I'm a newbie to JQuery and the Validation plugin. </p> <p>Short Description: I wanted all of my error messages to appear in one div at the top of the form, instead of next to each label. After a little head scratching and net searching, I came up with the following, which works, but the sourceurl: message comes up twice on the validation. I haven't a clue as to why. Any help would be appreciated. Cheers, John</p> <p>Source Code:</p> <pre><code>&lt;form name="siteauth" id="siteauth" action="savedata" type="POST"&gt; &lt;div class="message"&gt;&lt;/div&gt; &lt;fieldset&gt; &lt;label&gt;Short Description:&lt;/label&gt; &lt;br&gt;&lt;input id="shortdescription" size="75" type="text" maxlength="50" name="shortdescription"/&gt; &lt;br&gt;&lt;label&gt;Source URL:&lt;/label&gt; &lt;br&gt;&lt;input id ="sourceurl" size="75" type="text" maxlength="500" name="sourceurl"/&gt; &lt;br&gt;&lt;label&gt;Callback URL:&lt;/label&gt; &lt;br&gt;&lt;input id="callbackurl" size="75" type="text" maxlength="500" name="callbackurl"/&gt; &lt;br&gt;&lt;label&gt;Callback Content:&lt;/label&gt; &lt;br&gt;&lt;input id="in4" size="75" type="text" maxlength="100" name="callbackcontent"/&gt; &lt;br&gt; &lt;br&gt;&lt;input type="submit" value="Add"/&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function(){ $("#siteauth").validate({ rules: { shortdescription: "required", sourceurl: "required" }, messages: { shortdescription: "Enter a short description. ", sourceurl: "Enter a Source URL. " }, errorElement: "div", wrapper: "div class=\"message\"", errorPlacement: function (error, element){ error.appendTo($(".message")); } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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