Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to validate radio part?
    primarykey
    data
    text
    <p>I created the following form:</p> <p><a href="http://jsfiddle.net/baumdexterous/KKqbT/1/" rel="nofollow">http://jsfiddle.net/baumdexterous/KKqbT/1/</a></p> <pre><code> &lt;!-- VALIDATION NOTIFICATION --&gt; &lt;div id="drawer"&gt;Please fill in the empty fields marked with a &lt;samp style="color:red"&gt;red&lt;/samp&gt; border.&lt;/div&gt; &lt;!-- END VALIDATION NOTIFICATION --&gt; &lt;!-- FORM --&gt; &lt;form action="#"&gt; &lt;div id="wizard"&gt; &lt;div class="items"&gt; &lt;div class="page"&gt; &lt;ul&gt; &lt;li class="required"&gt; &lt;!-- INPUT --&gt; &lt;label&gt;Your Email:&lt;br&gt;&lt;input type="text" class="text" name="email"&gt;&lt;/label&gt; &lt;!-- SELECT DROPDOWN --&gt; &lt;label&gt;Your City &lt;select name="city"&gt; &lt;option value=""&gt;-- please select --&lt;/option&gt; &lt;option&gt;Helsinki&lt;/option&gt; &lt;option&gt;Berlin&lt;/option&gt; &lt;option&gt;New York&lt;/option&gt; &lt;/select&gt; &lt;/label&gt; &lt;!-- RADIO --&gt; &lt;label&gt;What's the U.S. capital?&lt;br&gt; &lt;div class="qselections"&gt; &lt;input type="radio" value="a" name="question1"&gt;a) New York&lt;br&gt; &lt;input type="radio" value="b" name="question1"&gt;b) Washington DC&lt;br&gt; &lt;input type="radio" value="c" name="question1"&gt;c) Seattle&lt;br&gt; &lt;input type="radio" value="d" name="question1"&gt;d) Portland&lt;br&gt; &lt;/div&gt; &lt;/label&gt; &lt;/li&gt; &lt;li class="clearfix"&gt; &lt;button type="button" class="next right"&gt; Proceed » &lt;/button&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;!-- end page --&gt; &lt;/div&gt;&lt;!--items--&gt; &lt;/div&gt;&lt;!--wizard--&gt; &lt;/form&gt; </code></pre> <p>Here is the existing validation:</p> <pre><code> $(function() { var root = $("#wizard").scrollable(); // some variables that we need var api = root.scrollable(), drawer = $("#drawer"); // validation logic is done inside the onBeforeSeek callback api.onBeforeSeek(function(event, i) { // we are going 1 step backwards so no need for validation if (api.getIndex() &lt; i) { // 1. get current page var page = root.find(".page").eq(api.getIndex()), // 2. .. and all required fields inside the page inputs = page.find(".required :input").removeClass("error"), // 3. .. which are empty empty = inputs.filter(function() { return $(this).val().replace(/\s*/g, '') == ''; }); // if there are empty fields, then if (empty.length) { // slide down the drawer drawer.slideDown(function() { // colored flash effect drawer.css("backgroundColor", "#229"); setTimeout(function() { drawer.css("backgroundColor", "#fff"); }, 1000); }); // add a CSS class name "error" for empty &amp; required fields empty.addClass("error"); // cancel seeking of the scrollable by returning false return false; // everything is good } else { // hide the drawer drawer.slideUp(); } } // update status bar $("#status li").removeClass("active").eq(i).addClass("active"); }); // if tab is pressed on the next button seek to next page root.find("button.next").keydown(function(e) { if (e.keyCode == 9) { // seeks to next tab by executing our validation routine api.next(); e.preventDefault(); } }); }); </code></pre> <p>I am able to validate the input part and select dropdown form elements just fine... but for some reason unable to validate the radio form element. Anyone knows what I need to do specifically to this code to make the radio validation work? Thank you.</p>
    singulars
    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