Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sumbit a form wizard using jQuery steps

I have installed jQuery steps, and want to make a form with a step wizard. Problem is how to sumbit the form with PHP when the "Finish" button appears. All the code below works, exept the handling of the last submit.

My form example code:

<form method="POST" action="#" role="form">
    <div id="wizard">
        <h2>Info</h2>
        <section>
              <div class="form-group">
                <label for="text">Email address:</label>
                <input type="text" class="form-control" id="text">
              </div>
        </section>

        <h2>Second Step</h2>
        <section>
           //form stuff
        </section>

        <h2>Third Step</h2>
        <section>
           //form stuff
        </section>

        <h2>Forth Step</h2>
        <section>
            form stuff
        </section>
    </div>
</form>

Script that calls jQuery steps:

<script>
    $(function ()
    {
        $("#wizard").steps({
            headerTag: "h2",
            bodyTag: "section",
            transitionEffect: "slideLeft",
            stepsOrientation: "vertical"
        });
    });
</script>

Last i want to sumbit the form wizard to db using PHP:

<?php 
if(isset($_POST['submit'])){
    //save values
}

?>

like image 866
sdfgg45 Avatar asked Feb 01 '26 07:02

sdfgg45


1 Answers

The onFinished method can be used for submitting the form to the server

onFinished: function (event, currentIndex) {
    var form = $(this);
    // Submit form input
    form.submit();
},
like image 126
Selwyn Theogarajan Avatar answered Feb 03 '26 02:02

Selwyn Theogarajan