Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
- <title>jquery-steps | validation step by step</title>
- <!-- Bootstrap -->
- <link href="css/bootstrap.css" rel="stylesheet" type="text/css">
- <link rel="stylesheet" type="text/css" href="css/font-awesome.css">
- <link rel="stylesheet" href="css/jquery.steps.css">
- <script src="js/jquery-1.11.2.min.js"></script>
- <script src="js/jquery.steps.js"></script>
- <script>
- // Tries to load the saved state (step position)
- if (options.saveState && $.cookie)
- {
- var savedState = $.cookie(_cookiePrefix + getUniqueId(wizard));
- // Sets the saved position to the start index if not undefined or out of range
- var savedIndex = parseInt(savedState, 0);
- if (!isNaN(savedIndex) && savedIndex < state.stepCount)
- {
- startIndex = savedIndex;
- }
- }
- </script>
- <style type="text/css">
- #multiphase.form-control-feedback {
- /* To make the feedback icon visible */
- z-index: 100;
- }
- </style>
- <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
- <![endif]-->
- </head>
- <body>
- <!-- wrapper container-->
- <div id="wrapper">
- <!-- main container div-->
- <div id="container" class="container">
- <div class="row">
- <div id="maincontent" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
- <div class="row">
- <div id="" class="col-lg-12">
- <form id="multiphase" role="form" class="form-horizontal" action="" method="post">
- <div id="wizard">
- <h2>Step</h2>
- <section>
- <h2>Student's Details:</h2>
- <hr>
- <div class="form-group">
- <label for="sd_lastname" class="col-lg-2 control-label">Last Name:</label>
- <div class="col-lg-3">
- <input type="text" name="sd_lastname" id="sd_lastname" class="form-control" placeholder="Last Name" value="" tabindex="1">
- </div>
- </div>
- <div class="form-group">
- <label for="sd_firstname" class="col-lg-2 control-label">First Name:</label>
- <div class="col-lg-3">
- <input type="text" name="sd_firstname" id="sd_firstname" class="form-control" placeholder="First Name" value="" tabindex="2">
- </div>
- </div>
- </section>
- <h2>Step</h2>
- <section>
- <h2>Parent's Details:</h2>
- <hr>
- <div class="form-group">
- <label for="pd_lastname" class="col-lg-2 control-label">Last Name:</label>
- <div class="col-lg-3">
- <input type="text" name="pd_lastname" id="pd_lastname" class="form-control" placeholder="Last Name" value="" tabindex="1">
- </div>
- </div>
- <div class="form-group">
- <label for="pd_firstname" class="col-lg-2 control-label">First Name:</label>
- <div class="col-lg-3">
- <input type="text" name="pd_firstname" id="pd_firstname" class="form-control" placeholder="First Name" value="" tabindex="2">
- </div>
- </div>
- </section>
- <h2>Step</h2>
- <section>
- <h2>Reference Details:</h2>
- <hr>
- <div class="form-group">
- <label for="rd_schoolrefname" class="col-lg-3 control-label">School Principal's Name:</label>
- <div class="col-lg-3">
- <input type="text" name="rd_schoolrefname" id="rd_schoolrefname" class="form-control" placeholder="First Name Last Name" value="" tabindex="1">
- </div>
- </div>
- <div class="form-group">
- <label for="rd_schoolrefmobile" class="col-lg-3 control-label">Phone or Mobile No.:</label>
- <div class="col-lg-2">
- <input type="text" name="rd_schoolrefmobile" id="rd_schoolrefmobile" class="form-control" placeholder="Phone or Mobile Number" data-mask="+99-99999-99999" value="" tabindex="2">
- </div>
- </div>
- <div class="form-group">
- <label for="rd_schoolrefemail" class="col-lg-3 control-label">E-Mail ID:</label>
- <div class="col-lg-3">
- <input type="text" name="rd_schoolrefemail" id="rd_schoolrefemail" class="form-control" placeholder="E-Mail ID" value="" tabindex="3">
- </div>
- </div>
- </section>
- </div><!-- end of wizard-->
- </form><!-- end of form-->
- </div>
- </div><!-- end of row-->
- <div class="modal fade" id="modal-1">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <h1 class="modal-title text-center">Add new last name</h1>
- </div>
- <div class="modal-body">
- <form method="POST" name="add_lastname">
- <input type="text" name="add_lastname" id="add_lastname" class="form-control" placeholder="Enter your last name here" value="">
- <p class="">The first alphabet of the last name <strong>MUST</strong> be in upper case.</p>
- </form>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
- <input name="addlastname" type="submit" value="Add" class="btn btn-primary">
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="row hidden-print">
- <div id="footer" class="col-lg-12">
- </div>
- </div>
- </div>
- </div>
- <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
- <script src="js/bootstrap.min.js"></script>
- <script type="text/javascript" src="js/bootstrapValidator.js"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- $("#wizard").steps({
- headerTag: "h2",
- bodyTag: "section",
- saveState: true,
- })
- $('#multiphase').bootstrapValidator({
- excluded: ':disabled',
- message: 'This value is not valid',
- container: 'tooltip',
- feedbackIcons: {
- valid: 'glyphicon glyphicon-ok',
- invalid: 'glyphicon glyphicon-remove',
- validating: 'glyphicon glyphicon-refresh'
- },
- fields: {
- //last name validation
- sd_lastname: {
- container: 'popover',
- validators: {
- notEmpty: {
- message: 'The Last Name is required and cannot be empty'
- }
- }
- },
- //first name validation
- sd_firstname: {
- container: 'popover',
- validators: {
- notEmpty: {
- message: 'The First Name is required and cannot be empty'
- },
- stringLength: {
- min: 3,
- max: 30,
- message: 'The First Name must be more than 7 and less than 30 characters long'
- },
- regexp: {
- regexp: /^[A-Z]+$/i,
- message: 'The First Name can only consist of alphabetical characters'
- }
- }
- },
- //validation of Parent's details step start
- //last name validation
- pd_lastname: {
- container: 'popover',
- validators: {
- notEmpty: {
- message: 'The Last Name is required and cannot be empty'
- }
- }
- },
- //first name validation
- pd_firstname: {
- container: 'popover',
- validators: {
- notEmpty: {
- message: 'The First Name is required and cannot be empty'
- },
- stringLength: {
- min: 3,
- max: 30,
- message: 'The First Name must be more than 7 and less than 30 characters long'
- },
- regexp: {
- regexp: /^[A-Z]+$/i,
- message: 'The First Name can only consist of alphabetical characters'
- }
- }
- },
- // Validation for Reference details starts
- //School reference name
- rd_schoolrefname: {
- container: 'popover',
- validators: {
- notEmpty: {
- message: 'The School Reference Name is required and cannot be empty'
- },
- stringLength: {
- min: 7,
- max: 40,
- message: 'The School Reference Name must be more than 7 and less than 40 characters long'
- },
- regexp: {
- regexp: /^[A-Z\s]+$/i,
- message: 'The School Reference Name can only consist of alphabetical characters'
- }
- }
- },
- //School reference phone
- rd_schoolrefmobile: {
- container: 'popover',
- validators: {
- notEmpty: {
- message: 'The Phone or Mobile is required and cannot be empty'
- }
- }
- },
- rd_schoolrefemail: {
- container: 'popover',
- validators: {
- notEmpty: {
- message: 'The E-Mail ID is required and cannot be empty'
- },
- regexp:{
- regexp: /[a-zA-Z0-9]+(?:(\.|_)[A-Za-z0-9!#$%&'*+\/=?^`{|}~-]+)*@(?!([a-zA-Z0-9]*\.[a-zA-Z0-9]*\.[a-zA-Z0-9]*\.))(?:[A-Za-z0-9](?:[a-zA-Z0-9-]*[A-Za-z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/g,
- message: 'The E-Mail ID is not a valid E-Mail'
- }
- }
- },
- }
- })
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement