带有条件子部分的多页面AJAX表单

时间:2022-05-19 20:07:47

I would like to go about creating a multi-page form that changes based on options that are selected on previous pages of the form.

我想创建一个多页面表单,该表单根据在表单的前一页上选择的选项进行更改。

I want to use Zend_Form, and I know JavaScript will be in charge of making the different form fields appear/disappear, but I don't know how the two will work together exactly.

我想使用Zend_Form,我知道JavaScript将负责使不同的表单字段显示/消失,但我不知道两者将如何完全一起工作。

My question is how to get started creating this kind of form with Zend_Form and JavaScript? I am familiar with jQuery, so if there is a jQuery plugin that helps with this, let me know.

我的问题是如何使用Zend_Form和JavaScript开始创建这种表单?我熟悉jQuery,所以如果有一个jQuery插件可以帮助我,请告诉我。

3 个解决方案

#1


I you're going to create a spruced-up multipage form that does all kinds of neat tricks, I would not suggest using Zend_Form, as it will probably just get in your way, but that's just my opinion. I use the Zend Framework, but I never saw the need to use Zend Form, as I like coding everything form related myself.

我打算创建一个多样化的多重形式,可以做各种巧妙的技巧,我不会建议使用Zend_Form,因为它可能会妨碍你,但这只是我的看法。我使用Zend Framework,但我从未看到使用Zend Form的必要性,因为我喜欢编写与我自己相关的所有内容。

I would build the form in plain-old HTML, you could use the jQuery tabs plugin to divide the form up into pages in a sleeker way, and the jQuery form plugin to assist with serialization of the form and ajax submission.

我将使用普通的HTML构建表单,您可以使用jQuery选项卡插件以更流畅的方式将表单分成页面,并使用jQuery表单插件来协助表单和ajax提交的序列化。

There's also the jQuery validation plugin, but I've never tried it out.

还有jQuery验证插件,但我从未尝试过。

Good luck with that.

祝你好运。

#2


If you want to use JavaScript i would highly recommend the jQuery wizard plugin. It supports branching and validation.

如果你想使用JavaScript,我强烈推荐使用jQuery向导插件。它支持分支和验证。

#3


I agree with jquery comments, in that if you're familiar with it, I'm pretty sure theres a zend hookup with jquery.

我同意jquery的评论,因为如果你熟悉它,我很确定这是一个与jquery的zend连接。

That being said, if you can avoid breaking the form up onto multiple physically different pages, just have them logically separated, ie: reload data in a div(or tabs as karim mentioned), etc, so that you can maintain all the info being tracked in the form. If you must have physically separated pages, you can use sessions to store the persistent data.

话虽这么说,如果你可以避免将表单分成多个物理上不同的页面,只需将它们逻辑分开,即:在div中重新加载数据(或者像karim所提到的标签)等,这样你就可以维护所有的信息了跟踪形式。如果必须具有物理上分离的页面,则可以使用会话来存储持久数据。

This may help you to start out with, though I don't know your exact zend setup: http://framework.zend.com/manual/en/zendx.jquery.form.html

这可能会帮助你开始,虽然我不知道你的确切zend设置:http://framework.zend.com/manual/en/zendx.jquery.form.html

#1


I you're going to create a spruced-up multipage form that does all kinds of neat tricks, I would not suggest using Zend_Form, as it will probably just get in your way, but that's just my opinion. I use the Zend Framework, but I never saw the need to use Zend Form, as I like coding everything form related myself.

我打算创建一个多样化的多重形式,可以做各种巧妙的技巧,我不会建议使用Zend_Form,因为它可能会妨碍你,但这只是我的看法。我使用Zend Framework,但我从未看到使用Zend Form的必要性,因为我喜欢编写与我自己相关的所有内容。

I would build the form in plain-old HTML, you could use the jQuery tabs plugin to divide the form up into pages in a sleeker way, and the jQuery form plugin to assist with serialization of the form and ajax submission.

我将使用普通的HTML构建表单,您可以使用jQuery选项卡插件以更流畅的方式将表单分成页面,并使用jQuery表单插件来协助表单和ajax提交的序列化。

There's also the jQuery validation plugin, but I've never tried it out.

还有jQuery验证插件,但我从未尝试过。

Good luck with that.

祝你好运。

#2


If you want to use JavaScript i would highly recommend the jQuery wizard plugin. It supports branching and validation.

如果你想使用JavaScript,我强烈推荐使用jQuery向导插件。它支持分支和验证。

#3


I agree with jquery comments, in that if you're familiar with it, I'm pretty sure theres a zend hookup with jquery.

我同意jquery的评论,因为如果你熟悉它,我很确定这是一个与jquery的zend连接。

That being said, if you can avoid breaking the form up onto multiple physically different pages, just have them logically separated, ie: reload data in a div(or tabs as karim mentioned), etc, so that you can maintain all the info being tracked in the form. If you must have physically separated pages, you can use sessions to store the persistent data.

话虽这么说,如果你可以避免将表单分成多个物理上不同的页面,只需将它们逻辑分开,即:在div中重新加载数据(或者像karim所提到的标签)等,这样你就可以维护所有的信息了跟踪形式。如果必须具有物理上分离的页面,则可以使用会话来存储持久数据。

This may help you to start out with, though I don't know your exact zend setup: http://framework.zend.com/manual/en/zendx.jquery.form.html

这可能会帮助你开始,虽然我不知道你的确切zend设置:http://framework.zend.com/manual/en/zendx.jquery.form.html