表格保留数据 [英] Forms Retaining Data

查看:66
本文介绍了表格保留数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的一位客户就其

网站上的表格提出了一个问题。


来自这些表格的数据由PHP处理脚本,如果一切顺利

,就会出现一个感谢屏幕。有时候,当你回到表单

(通过点击后退按钮)时,数据仍然存在于表单字段中。

其他时候它不是。客户希望确保数据保持不变,因为他们有时会通过类似的条目提交多份文件。


有客户端验证(JavaScript )在表格上,但除了

之外,没有别的特别之处。


有没有办法确保字段中的值保留在返回状态,或者是

这只是浏览器中的一个怪癖?最常用的浏览器是IE& NN。


我会包含相关表格的链接,但它是

a州长服务的请求表格(直接发送给政府'')办公室),我讨厌

看到他们收到假请求。

谢谢。


-

SamMan

翻录回复

A question came up at work from one of our clients about forms on their
site.

The data from these forms are processed by a PHP script and if all goes
well, a thank you screen appears. Sometimes, when you go back to the form
(by clicking the back button), the data is still there in the form fields.
Other times it is not. The client would like to ensure the data remains, as
they sometimes have multiple submissions to make with similar entries.

There is client-side validation (JavaScript) on the forms, but other than
that, nothing else special about them.

Is there a way to ensure the values in the fields remain on return, or is
this just a quirk in browsers? The most commonly used browsers are IE & NN.

I would include a link to the form in question, but it is a request form for
a gubernatorial service (sent directly to the Gov''s office), and I''d hate to
see them receive bogus requests.
Thanks.

--
SamMan
Rip it to reply

推荐答案

SamMan写道:
SamMan wrote:
客户希望确保数据保持不变,因为他们有时会使用类似的条目进行多次提交。


这是在许多浏览器中实现的功能,但不是全部。你不能依赖它,因为你无法操纵用户的浏览器。但是,如果遇到
a问题,并通过PHP检查发现错误,

您应该能够重建表单并填写值,所有

使用PHP。用户不必依赖他/她的b
浏览器可能没有的功能。

表单上有客户端验证(JavaScript),但是除了
之外,没有其他特别之处。
The client would like to ensure the data remains, as
they sometimes have multiple submissions to make with similar entries.
This is a feature implemented in many browsers, but not all. You cannot
rely on it, since you cannot manipulate the user''s browser. However, if
a problem is encountered and an error is found by checking it with PHP,
you should be able to reconstruct the form and fill in the values, all
using PHP. The user shouldn''t have to depend on a feature his/her
browser might not have.
There is client-side validation (JavaScript) on the forms, but other than
that, nothing else special about them.




JS验证没问题,但最不应该依赖它。

-

Michael Wilcox, http://mikewilcox.t35。 com /


2004年4月30日星期五,Michael Wilcox写道:
On Fri, 30 Apr 2004, Michael Wilcox wrote:
这是一个在许多浏览器,但不是全部。你不能依赖它,因为你无法操纵用户的浏览器。


正确...

但是,如果遇到问题并且通过用PHP检查发现错误,你应该能够使用PHP重建表单并填写值。用户不必依赖他/她的浏览器可能没有的功能。
This is a feature implemented in many browsers, but not all. You cannot
rely on it, since you cannot manipulate the user''s browser.
right...
However, if a problem is encountered and an error is found by
checking it with PHP, you should be able to reconstruct the form and
fill in the values, all using PHP. The user shouldn''t have to depend
on a feature his/her browser might not have.




很好的答案。对于其他服务器端脚本也是如此,尽管

- 它不仅限于PHP:例如CGI.pm模块使得这个

非常简单带有CGI的Perl。



Good answer. The same is true for other server-side scripting, though
- it''s not limited to PHP: for example the CGI.pm module makes this
quite straightforward in Perl with CGI.

表单上有客户端验证(JavaScript),但除了
之外,没什么特别的他们。
There is client-side validation (JavaScript) on the forms, but other than
that, nothing else special about them.



JS验证是可以的,但最不应该依赖它。



JS validation is ok, but most defiantly should not be relied on.




哦,大多数反对 ;真的;-) SCNR。


js支票对双方都有用,作为一个可选的方便,

但是肯定提交的参数必须完全[1]验证

在服务器上。


[1]其中完全由应用程序的要求定义。


hth



Oh, most "defiantly" true ;-) SCNR.

js checks can be useful to both parties as an optional convenience,
but most certainly the submitted parameters must be fully[1] validated
at the server.

[1] where "fully" is defined by the requirements of the application.

hth


" Alan J. Flavell" < FL ***** @ ph.gla.ac.uk>在消息中写道

新闻:Pi ******************************* @ ppepc56.ph。 gla.ac.uk ...
"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote in message
news:Pi*******************************@ppepc56.ph. gla.ac.uk...
2004年4月30日星期五,Michael Wilcox写道:
On Fri, 30 Apr 2004, Michael Wilcox wrote:
这是在许多浏览器中实现的功能,但不是所有。你不能依赖它,因为你无法操纵用户的浏览器。
This is a feature implemented in many browsers, but not all. You cannot
rely on it, since you cannot manipulate the user''s browser.



对...



right...

但是,如果遇到问题并且通过PHP检查发现错误,您应该能够重建表单并使用PHP填写值。用户不必依赖他/她的浏览器可能没有的功能。
However, if a problem is encountered and an error is found by
checking it with PHP, you should be able to reconstruct the form and
fill in the values, all using PHP. The user shouldn''t have to depend
on a feature his/her browser might not have.



很好的答案。其他服务器端脚本也是如此,但它不仅限于PHP:例如CGI.pm模块使用CGI在Perl中非常简单。



Good answer. The same is true for other server-side scripting, though
- it''s not limited to PHP: for example the CGI.pm module makes this
quite straightforward in Perl with CGI.

表单上有客户端验证(JavaScript),但除此之外还有其他
,没有什么特别之处。
There is client-side validation (JavaScript) on the forms, but other than that, nothing else special about them.



JS验证是可以的,但最不应该依赖。



JS validation is ok, but most defiantly should not be relied on.



哦,大多数挑衅真的;-) SCNR。

js检查对双方都有用,作为一个可选的方便,
但大多数肯定提交的参数必须完全[1]验证
服务器。

[1]其中完全由应用程序的要求定义。

hth



Oh, most "defiantly" true ;-) SCNR.

js checks can be useful to both parties as an optional convenience,
but most certainly the submitted parameters must be fully[1] validated
at the server.

[1] where "fully" is defined by the requirements of the application.

hth




感谢你们两位的建议。我有点认为这是一个浏览器

特定的功能。


我同意JavaScript(JS)通常不是最好的工具,但在此

的情况,我认为它有效。表单只需获取表单数据并将其发送到电子邮件帐户,并且永远不会被处理(数据库等)。

JS只是基本上检查空值和格式,所以当

数据被发送给负责仪式的人时,显然&对他们来说是有意义的。我也有,所以如果最终用户已禁用JS,则提交

按钮也会被禁用。我写了后端来替换一个珍珠脚本,

我们的代理商不允许改变(为州政府机构工作很有趣!),

并且难以管理和放大;改变。另外,真正负责

表格(和网站)的人是退伍军人。在web开发中10年,甚至不能写。

简单的JS。我想做所有验证服务器端,但不能,

因为我必须尽可能简单地为同事保留它。


再次感谢!


-

SamMan

撕开它回复



Thanks to both of you for your advice. I kind of thought it was a browser
specific feature.

I agree that JavaScript (JS) isn''t generally the best tool, but in this
case, I think it works. The form(s) just takes the form data and sends it to
an e-mail account(s), and is never processed any further (database, etc.).
The JS just basically checks for null values and formatting, so when the
data is sent to the person in charge of the ceremonies, it is clear & makes
sense to them. I also have it so if the end-user has JS disabled, the submit
button is also disabled. I wrote the backend to replace a Pearl script that
our agency was not allowed to alter (working for state agencies is fun!),
and made it hard to manage & alter. Also, the person really in charge of the
forms (and site) is a "veteran" of 10 years in web dev that can''t even write
simple JS. I wanted to do all of the validation server-side, but couldn''t,
as I had to keep it as simple as possible for the co-worker.

Thanks again!

--
SamMan
Rip it to reply


这篇关于表格保留数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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