Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Validate: "nothing selected" in Safari
    primarykey
    data
    text
    <p>I'm using JQuery Validate, and it's doing the weirdest thing in Safari. If I don't select anything, it gives me the correct error message. But as soon as I fulfill the form requirements and hit submit, it just refreshes the page rather than submitting the form. The console message is "nothing selected, can't validate, returning nothing".</p> <p>This is my validation script:</p> <pre> $(document).ready(function() { /* ------------ FORM #STORY1 ------------ */ $('#class').focus(function(){ $('#alum').attr('checked',true); }); $('#college').focus(function(){ $('#transfer').attr('checked',true); }); /* The validation script */ $("#story1").submit(function(){ return false; }); // Turn our validator into a function var story1Validate = function(form){ $(form).find('div#err_msg').hide(); $(form).find('#submitBtn').removeAttr('disabled'); $(form).validate({ debug:false, submitHandler: function(form) { $('#submitBtn').attr('disabled','disabled'); $('#submitBtn').hide(); $('#process').show(); $('#recaptcha_widget_div').hide(); form.submit(); }, errorContainer: $(form).find('div#err_msg'), errorPlacement: function(error, element) { $(form).find('div#err_msg').show(); error.appendTo(form+' div#err_msg'); }, rules: { type: "required", class: { required: "#alum:checked" }, college: { required: "#transfer:checked" } },//rules messages: { type: "Please make a selection.", class: { required:"You indicated that you're an alum. Please enter the year you graduated." }, college: { required:"You indicated that you're a transfer student. Please enter the name of the school to which you transferred." } }//messages });//form validate }//customValidation function // Attach our custom form function to the form story1Validate("#story1"); }); </pre> <p>And this is the accompanying form's HTML:</p> <pre><code> &lt;form id="story1" name="story1" method="post" action="your-story/index.php" class="form-intro"&gt; &lt;h3&gt;I am a...&lt;/h3&gt; &lt;p&gt; &lt;input name="type" type="radio" class="input-radio" id="alum" value="alum" /&gt; &lt;label for="alum"&gt;Alum, class of&lt;/label&gt;&lt;br /&gt; &lt;input name="class" type="text" class="input-txt" id="class" value="" /&gt; &lt;/p&gt; &lt;p&gt; &lt;input name="type" type="radio" class="input-radio" id="transfer" value="transfer" /&gt; &lt;label for="transfer"&gt;Transfer student to&lt;/label&gt;&lt;br /&gt; &lt;input name="college" type="text" class="input-txt" id="college" value="" /&gt; &lt;/p&gt; &lt;p&gt; &lt;input name="type" type="radio" class="input-radio" id="student" value="student" /&gt; &lt;label for="student"&gt;Current student&lt;/label&gt; &lt;/p&gt; &lt;p&gt; &lt;input name="type" type="radio" class="input-radio" id="staff" value="staff" /&gt; &lt;label for="staff"&gt;Professor or staff member&lt;/label&gt; &lt;/p&gt; &lt;p&gt; &lt;input name="type" type="radio" class="input-radio" id="" value="other" /&gt; &lt;label for="other"&gt;None of the above&lt;/label&gt; &lt;/p&gt; &lt;div id="err_msg"&gt; &lt;/div&gt; &lt;footer class="form-nav"&gt; &lt;input name="submitBtn" type="submit" class="input-btn" id="submitBtn" value="Next &amp;gt;" /&gt; &lt;/footer&gt; &lt;/form&gt; </code></pre> <p>I've only seen it do this on Safari (both Mac and PC) and occasionally when I submit the form then hit the back button in Firefox. Seems to work fine in IE, too. </p> <p>Any ideas?? This is driving me bonkers!</p>
    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.
 

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