简体   繁体   English

构建多页响应表单的最佳方法是什么?

[英]What's the best way building a multi-page responsive form?

I have to design a so long form, and it has to be responsive. 我必须设计一个很长的表格,而且它必须响应迅速。 In desktop layout there is no problem displaying a lot of controls, but not the same in mobile. 在桌面布局中,显示很多控件没有问题,但在移动设备中却不一样。 So I divided the form into "steps", like this: 因此,我将表单分为“步骤”,如下所示:

<form action="#" method="post">

    <h1>My Wizzard</h1>

    <div id="first_step">
    ...
    </div>

    <div id="second_step">
    ...
    </div>
</form>

So, with CSS I hide and show one step at time. 因此,使用CSS可以一次隐藏并显示一个步骤。 The problem is I need a submit button on every div-step, because if not the form is hidden. 问题是我在每个div步骤上都需要一个提交按钮,因为如果没有的话,表单是隐藏的。 And I really don't need the submit until the last step. 我真的不需要提交,直到最后一步。 So, now I'm wondering if I'm designing this right and if there is another better way to do it. 所以,现在我想知道我是否正在设计这项权利,是否还有另一种更好的方法来做到这一点。

Any suggestion will be appreciated!! 任何建议将不胜感激! Thanks in advance, 提前致谢,

Well you may use a next button at every step and onclick of it you can fire an AJAX request to save that data to database or if you want to save it to the browser you can do it as well. 那么你可以在每一步使用下一个按钮onclick它可以触发一个AJAX请求到数据保存到数据库,或者如果你想将其保存到浏览器,你可以做得一样好。

And finally on the last step use submit button. 最后,在最后一步,使用提交按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM