"Form wizard in Modal"
Bootstrap 3.0.0 Snippet by ariunbolor

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Multistep form wizard on modal</h2> <div class="center"><button data-toggle="modal" data-target="#requestform" class="btn btn-primary center-block">Click Me</button></div> </div> </div> <!---- Modal ---> <!-- line modal --> <div class="modal fade" id="requestform" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> <h3 class="modal-title" id="lineModalLabel">My Modal</h3> </div> <div class="modal-body"> <!-- Steps starts here --> <div class="requestwizard"> <div class="requestwizard-row setup-panel"> <div class="requestwizard-step"> <a href="#step-1" type="button" class="btn btn-primary btn-circle">1</a> <p>Contact information</p> </div> <div class="requestwizard-step"> <a href="#step-2" type="button" class="btn btn-default btn-circle" disabled="disabled">2</a> <p>Project information</p> </div> <div class="requestwizard-step"> <a href="#step-3" type="button" class="btn btn-default btn-circle" disabled="disabled">2</a> <p>Stone information</p> </div> </div> </div> <form role="form"> <div class="row setup-content" id="step-1"> <div class="col-xs-12"> <div class="col-md-12"> <div class="form-group"> <label class="control-label">Full Name</label> <input maxlength="100" type="text" required="required" class="form-control" placeholder="Enter First Name" /> </div> <div class="form-group"> <label class="control-label">Day time phone</label> <input maxlength="100" type="text" required="required" class="form-control" placeholder="Enter Last Name" /> </div> <div class="form-group"> <label class="control-label">Alternative phone</label> <input maxlength="100" type="text" required="required" class="form-control" placeholder="Enter Last Name" /> </div> <div class="form-group"> <label class="control-label">Email address</label> <input maxlength="100" type="text" required="required" class="form-control" placeholder="Enter Last Name" /> </div> <button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Next</button> </div> </div> </div> <div class="row setup-content" id="step-2"> <div class="col-xs-12"> <div class="col-md-12"> <div class="form-group"> <label class="control-label">Name of your project</label> <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" /> </div> <div class="form-group"> <label class="control-label">Address of project site</label> <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" /> </div> <div class="form-group"> <label class="control-label">When do you want to start your project</label> <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Address" /> </div> <button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Next</button> </div> </div> </div> <div class="row setup-content" id="step-3"> <div class="col-xs-12"> <div class="col-md-12"> <div class="form-group"> <label class="control-label">What type of material are you interested in</label> <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" /> </div> <div class="form-group"> <label class="control-label">Select the type of edge</label> <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" /> </div> <div class="form-group"> <label class="control-label">Select the type of sink (if applicable)</label> <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Address" /> </div> <div class="form-group"> <label class="control-label">Backsplash height</label> <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Address" /> </div> <div class="form-group"> <label class="control-label">Drawing</label> <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Address" /> </div> <div class="form-group"> <label class="control-label">Additional Note</label> <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Address" /> </div> <button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Next</button> </div> </div> </div> </form> <!-- Form ends here --> </div> </div> </div> </div>
.requestwizard-modal{ background: rgba(255, 255, 255, 0.8); box-shadow: rgba(0, 0, 0, 0.3) 20px 20px 20px; } .requestwizard-step p { margin-top: 10px; } .requestwizard-row { display: table-row; } .requestwizard { display: table; width: 100%; position: relative; } .requestwizard-step button[disabled] { opacity: 1 !important; filter: alpha(opacity=100) !important; } .requestwizard-row:before { top: 14px; bottom: 0; position: absolute; content: " "; width: 100%; height: 1px; background-color: #ccc; z-order: 0; } .requestwizard-step { display: table-cell; text-align: center; position: relative; } .btn-circle { width: 30px; height: 30px; text-align: center; padding: 6px 0 6px 0; font-size: 12px; line-height: 1.428571429; border-radius: 15px; }
$(document).ready(function () { var navListItems = $('div.setup-panel div a'), allWells = $('.setup-content'), allNextBtn = $('.nextBtn'); allWells.hide(); navListItems.click(function (e) { e.preventDefault(); var $target = $($(this).attr('href')), $item = $(this); if (!$item.hasClass('disabled')) { navListItems.removeClass('btn-primary').addClass('btn-default'); $item.addClass('btn-primary'); allWells.hide(); $target.show(); $target.find('input:eq(0)').focus(); } }); allNextBtn.click(function(){ var curStep = $(this).closest(".setup-content"), curStepBtn = curStep.attr("id"), nextStepWizard = $('div.setup-panel div a[href="#' + curStepBtn + '"]').parent().next().children("a"), curInputs = curStep.find("input[type='text'],input[type='url']"), isValid = true; $(".form-group").removeClass("has-error"); for(var i=0; i<curInputs.length; i++){ if (!curInputs[i].validity.valid){ isValid = false; $(curInputs[i]).closest(".form-group").addClass("has-error"); } } if (isValid) nextStepWizard.removeAttr('disabled').trigger('click'); }); $('div.setup-panel div a.btn-primary').trigger('click'); });

Related: See More


Questions / Comments: