Building on the Quick Start example, you can create a three-panel form with validation using the validating event.
Drop down and copy references to paste inside the head tags
References |
Copy Code |
---|---|
<!--jQuery References--> <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/ui/1.11.0/jquery-ui.min.js" type="text/javascript"></script> <!--Theme--> <link href="http://cdn.wijmo.com/themes/aristo/jquery-wijmo.css" rel="stylesheet" type="text/css" /> <!--Wijmo Widgets CSS--> <link href="http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20183.140.min.css" rel="stylesheet" type="text/css" /> <!--Wijmo Widgets JavaScript--> <script src="http://cdn.wijmo.com/jquery.wijmo-open.all.3.20183.140.min.js" type="text/javascript"></script> <script src="http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20183.140.min.js" type="text/javascript"></script> <script src="http://cdn.wijmo.com/interop/wijmo.data.ajax.3.20183.140.js" type="text/javascript"></script> <!--Ajax jQuery Validation--> <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js" type="text/javascript"></script> |
Drop down and copy script to paste in <head> section
Script |
Copy Code |
---|---|
<script id="scriptInit" type="text/javascript"> $(document).ready(function () { var $validator = $("#signupform").validate(); $('#pages').wijwizard({ validating: function (e, args) { if (args.nextIndex < args.index) return true; $("#signupform").valid(); var elements = $validator.invalidElements(); if (elements.length === 0) return true; var isValid = false; $.each(elements, function (i, ele) { if ($.contains(args.panel, ele)) { isValid = true; return false; } }); return !isValid; }, activeIndexChanged: function(e, data){ var w = $(this).data("wijmoWijwizard"), nb = w.nextBtn; if (data.index === w.count() - 1){ nb.removeClass(".ui-state-disabled").bind("click.submit", function(){ $("form").submit(); }).find(".ui-button-text").text("submit"); }else{ nb.find(".ui-button-text").text("next"); } } }); $('li.ui-widget-header').each(function (index, elem) { $(elem).click(function (args) { var stepIndex = $('li.ui-widget-header').index(elem); $('#pages').wijwizard("show", stepIndex); }); }); }); </script> |
Drop down and copy script to paste in <head> section
Markup |
Copy Code |
---|---|
<form id="signupform"> <div id="pages"> <ul> <li><a href="#logindata">Login data</a></li> <li><a href="#personaldata">Personal data</a></li> <li><a href="#subscriptions">Subscriptions</a></li> </ul> <div id="logindata"> <p> <label for="username">Username</label> <input id="username" name="username" class="required" minlength="3" maxlength="20" type="text" /> </p> <p> <label for="email">Email address</label> <input id="email" name="email" class="required email" type="text" /> </p> <p> <label for="password">Password</label> <input name="password" type="password" class="required" id="password" minlength="4" maxlength="50" /> </p> <p> <label for="confirmpassword">Confirm Password</label> <input name="confirmpassword" type="password" class="required" equalTo="#password" id="confirmpassword" /> </p> </div> <div id="personaldata"> <p> <label for="street">Street</label> <input id="street" name="street" class="required" minlength="3" maxlength="50" type="text" /> </p> <p> <label for="city">City</label> <input id="city" name="city" class="required" minlength="3" maxlength="50" type="text" /> </p> </div> <div id="subscriptions"> <p> <label for="weekly">Weekly Newsletter</label> <input id="weekly" name="weekly" type="checkbox" /> </p> <p> <label for="updates">Product Updates</label> <input id="updates" name="updates" type="checkbox" /> </p> <p> <label for="terms">Terms and conditions</label> <input id="terms" name="terms" class="required" type="checkbox" /> </p> </div> </div> </form> |