Note that there are some explanatory texts on larger screens.

plurals
  1. POgetting validate.js to work
    primarykey
    data
    text
    <p>I'm having trouble getting my simple contact form to validate and am not sure what I'm doing wrong, I've stripped the code almost exactly out of a stand alone demo and followed the tut. What's wrong with my code? </p> <p><a href="http://www.webreference.com/programming/javascript/jquery/form_validation/index.html" rel="nofollow">Tut &amp; demo</a></p> <p><strong>In the head:</strong> <em>Updated Attempt</em></p> <pre><code>&lt;script type="text/javascript" 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; </code></pre> <p><strong>Initiating, almost right before the closing</strong> <code>&lt;/head&gt;</code></p> <pre><code>&lt;script type="text/javascript"&gt; SubmittingForm=function() { alert("The form has been validated."); } $(document).ready(function() { $("#fvujq-form1").validate({ submitHandler:function(form) { SubmittingForm(); }, rules: { name: "required", // simple rule, converted to {required:true} email: { // compound rule required: true, email: true }, url: { url: true }, comment: { required: true } }, messages: { comment: "Please enter a comment." } }); }); jQuery.validator.addMethod( "selectNone", function(value, element) { if (element.value == "none") { return false; } else return true; }, "Please select an option." ); $(document).ready(function() { $("#fvujq-form2").validate({ submitHandler:function(form) { SubmittingForm(); }, rules: { sport: { selectNone: true } } }); }); &lt;/script&gt; </code></pre> <p><strong>Close to the bottom of page, form markup:</strong></p> <pre><code>&lt;p style="font-style:italic; font-size:12px; font-weigh: normal; margin-top: -89px; margin-left: 33px;"&gt;Contact me written in a different language.&lt;/p&gt; &lt;img src="http://www.cameroncashwell.com/imgs/pointing-left.png" style="float: right; margin-right: 140px; margin-top: -89px;"&gt; &lt;div class="form-div"&gt; &lt;form id="fvujq-form1" style="font-size:22px; color:#333;" method="post" action=""&gt; &lt;div class="form-row"&gt;&lt;span class="label"&gt;Name *&lt;/span&gt;&lt;input type="text" name="name" /&gt;&lt;/div&gt; &lt;div class="form-row"&gt;&lt;span class="label"&gt;E-Mail *&lt;/span&gt;&lt;input type="text" name="email" /&gt;&lt;/div&gt; &lt;div class="form-row"&gt;&lt;span class="label"&gt;URL&lt;/span&gt;&lt;input type="text" name="url" /&gt;&lt;/div&gt; &lt;div class="form-row"&gt;&lt;span class="label"&gt;Your Comment *&lt;/span&gt;&lt;textarea name="comment"&gt;&lt;/textarea&gt;&lt;/div&gt; &lt;div class="form-row"&gt;&lt;input class="submit" type="submit" value="Submit"&gt;&lt;/div&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>Also - where would I call my email address for the contact form's contents to be sent?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    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