jquery - 如何使用 jQuery 步骤提交表单向导

标签 jquery jquery-steps

我已经安装了 jQuery 步骤,并且想要使用步骤向导制作表单。 问题是当“完成”按钮出现时如何使用 PHP 提交表单。 除了最后一次提交的处理之外,下面的所有代码都有效。

我的表单示例代码:

<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>

调用 jQuery 步骤的脚本:

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

最后我想使用 PHP 将表单向导提交到数据库:

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

?>

最佳答案

onFinished方法可用于将表单提交到服务器

onFinished: function (event, currentIndex) {
    var form = $(this);
    // Submit form input
    form.submit();
},

关于jquery - 如何使用 jQuery 步骤提交表单向导,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32634493/

相关文章:

javascript - 基本 jquery 步骤向导

javascript - fb 登录弹出 block

javascript - 触发器在 jquery-steps 上不起作用?

jquery-steps - 在 jquery-steps 中更改按钮的名称

javascript - TinyMCE 和 Yii

jquery-steps - JQuery 步骤 : how to disable a step?

javascript - jquery-steps:如何防止页面滚动到顶部?

jquery - RaphaelJS + jQuery : How to define ID and CLASSES for paths

jQuery 隐藏列表

javascript - 使用 google api 时日期选择器不工作