Bootstrap 5 - form multi step wizard - validation one page at a time

I have a problem with my multi step form. Whenever I click the "next" button, instead of just the current tab being validated, it validates all the tabs on the form. How can I do to just validate only the current TAB?

If I have a form in each TAB, the validation will work as I want, but then I can't submit all forms at once.

index.php

<div> <ul> <li> <a href="#basic"> <span>Info</span> </a> </li> <li> <a href="#first"> <span>Device</span> </a> </li> </ul> <div> <div> <form method="post" action=""> <div> <label for="Client_Emp">Cliente/Empresa</label> <div> <input type="text" name="Client_Emp" required /> </div> </div> </form> </div> <div> <form method="post" action=""> <div> <label for="cpu">CPU</label> <div> <input type="text" name="cpu" required /> <option></option> </select> </div> </div> </form> </div> <ul> <li><a href="#">Previous</a> </li> <li><a href="#">Next</a></li> </ul> </div> <!-- tab-content -->
</div> <!-- end #rootwizard-->
5

1 Answer

Thanks. I managed to solve it with this javascript.

$("#global").submit(function(e) { var $ch1 = $("#form_info").children(); var $ch2 = $("#form_first").children(); var $ch3 = $("#form_second").children(); var $ch4 = $("#form_third").children(); var $ch5 = $("#form_fourth").children(); var $ch6 = $("#form_fifth").children(); $(this).append($ch1).append($ch2).append($ch3).append($ch4).append($ch5).append($ch6); $("#global").submit(); });

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like