带有jQuery的多步骤表单,如果关闭JS,它的效果会很好 [英] Multi step form with jQuery which degrades nicely if JS is turned off

查看:73
本文介绍了带有jQuery的多步骤表单,如果关闭JS,它的效果会很好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前已经设置了表单,以便使用Ajax刷新每个部分,但是在关闭JavaScript的情况下它并没有优雅地降级,我已经考虑将表单的每个部分放到一个单独的视图中,这可以正常工作但是说实话,那不是很好.

I currently had my form set up so that each section was refreshed using Ajax, however it didn’t degrade gracefully with JavaScript turned off and I’ve looked into putting each part of the form in to a separate view which works fine but isn’t that great to be honest.

我知道客户希望它看起来不错,所以我考虑使用jQuery显示和隐藏表单,因此,如果关闭JavaScript,则所有表单都将构建为一个长格式.但是,我面临的唯一问题是,在每个部分之后,用户都需要提交此信息,以便在下一阶段完成之前对其进行验证.如果因为其他形式的表单可见而关闭了JavaScript,该怎么办...

I know the client wants it to look nice so I thought about using jQuery to show and hide forms, so if JavaScript is turned off then all of the forms build in to one long form. However the only problem I am facing is that after each section the user needs to submit this information for it to be validated before the next stage is completed. How can I do this if JavaScript is turned off because the other forms will be visible...

有什么想法吗?谢谢.

推荐答案

您可能会考虑使用一个分为多个部分的长格式,然后,如果启用了JavaScript,则您一次只能隐藏一个部分,并在各部分之间提供导航(例如通过标签).

You might consider using one long form divided into sections, and then if JavaScript is enabled you hide all but one section at a time, providing navigation between the sections (via tabs, for instance).

或者,您可以查看使用scriptnoscript部分,但是最终您需要复制表格(一次在script部分中,一次在noscript部分中),然后开始变得维护问题.

Alternately, you could look at using script and noscript sections, but then you end up duplicating the form (once in the script sections, once in the noscript sections) and it starts getting to be a maintenance problem.

这篇关于带有jQuery的多步骤表单,如果关闭JS,它的效果会很好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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