jQuery 移动多页提交 [英] jQuery mobile multipage submit
问题描述
我正在使用 PhoneGap 和 jQuery Mobile 编写一个移动应用程序.为了简化导航,我想使用 div data-role="page" 将单个表单分布在多个页面"上.这个想法是为用户提供类似于向导的填写大型表单的体验.完成后,我需要能够将表单保存在本地,或者如果手机在线则提交.
I'm writing a mobile app with PhoneGap and jQuery Mobile. To simplify navigation I want to spread a single form over multiple 'pages' using div data-role="page". The idea is to give the user a wizard like experience for filling in a large form. On completion I need to be able to save the form locally, or submit it, if the mobile is online.
如果表单被拆分为多个虚拟"页面,我不明白如何使用 jQuery Mobile 提交或保存表单.我在网上搜索过,但找不到任何有关解决此问题的教程或示例.
I don't understand how to go about submitting or saving a form using jQuery Mobile if the form is split into multiple 'virtual' pages. I've search the web but can't find any tutorials or examples on solving this problem.
任何帮助将不胜感激.
更新:
我最近改变了处理多页表单的方式,这个解决方案对我来说效果很好.您基本上使用命名约定,其中字段通过为它们提供以部分名称和破折号开头的 id 成为部分的一部分,例如:人名、人名.请参阅下面的答案.
I recently changed the way I worked with multipage forms, and this solution worked nice for me. You basically use a naming convention where fields become part of sections by giving them id's starting with the section name and a dash, e.g: person-name, person-surname. See the answer below.
推荐答案
好的,我把我的想法写在这里:http://www.coldfusionjedi.com/index.cfm/2011/11/18/Demo-of-a-multistep-form-in-jQuery-移动
Ok, I posted my thoughts here: http://www.coldfusionjedi.com/index.cfm/2011/11/18/Demo-of-a-multistep-form-in-jQuery-Mobile
本质上,我最终使用了一种服务器端语言,一次只包含表单的正确部分.(我使用的是 ColdFusion,但任何语言都可以真正工作.)该表单自我发布并根据您在流程中的位置简单地显示正确的步骤.
Essentially I ended up using a sever side language to simply include the right part of the form at a time. (I'm using ColdFusion, but any language would work really.) The form self posts and simply displays the right step based on where you are in the process.
这篇关于jQuery 移动多页提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!