jQuery移动多页面提交 [英] jQuery mobile multipage submit

查看:104
本文介绍了jQuery移动多页面提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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.

任何帮助将不胜感激。

UPDATE:

我最近改变了我使用多页面表单的方式,这个解决方案对我很好。你基本上使用命名约定,其中字段成为节的一部分,通过给它们的id从节名称和短划线开始,例如:person-name,person-surname。请参阅下面的答案。

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/演示多形式在jQuery-Mobile

Ok, I posted my thoughts here: http://www.coldfusionjedi.com/index.cfm/2011/11/18/Demo-of-a-multistep-form-in-jQuery-Mobile

本质上,我最终使用服务器端语言简单地包括正确的部分一次的形式。 (我使用ColdFusion,但任何语言都可以工作。)表单self张贴,只是显示正确的步骤,根据你在过程中。

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆