表格验证Redux [英] Form Validation Redux

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

问题描述

首先想要回答我之前的问题所有人,你们很有帮助。


有几个一般性的问题。 />

为什么每个人都建议不在客户端使用VB脚本?


其次,我决定在处理页面上进行验证。

如果表单上的字段不符合验证规则,我可以将
重定向回发送页面。我如何做到这一点,以便发送

页面保留客户先前放入的值,这样他只需要


需要纠正无效的字段?


感谢您帮助nuuubeeeee .....


rh

First off wanted to that all that replied to my previous questions, you were
much help.

Had a couple of general questions.

Why has everyone suggested not using VB Script on the Client Side?

Secondly, I have decided to do my validation on the processing page.
If a field on the form does not meet the validation rules, I am able to
redirect back to the sending page. How do I do this so that the sending
page retains the values that the Client had previously put in so that he
only
needs to correct the fields that are not valid?

Thanks for helping out the nuuubeeeee.....

rh

推荐答案

客户端上的VBScript,只在IE中工作....据我所知。


第二件事,我会经常发帖到同一页.....


Example.asp


<%

Dim sUser

Dim sPass


sUser = Request.Form(" user")

sPass = Request.Form (通过)

''验证码在这里.......


%>


< form method = post action = Example.asp>

用户名:< input name =" user" value ="<%= sUser%>">< br>

密码:< input name =" pass" value ="<%= sPass%>">< br>

< input type = submit value =" submit">

< / form>

请注意,操作设置为Example.asp,其名称与当前

页面的名称相同。

" r0adhog" ; < RO ***** @ nospam.phreaker.net>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
VBScript on the client, only works in IE....as far as I know.

For the second thingy, I will often post to the same page.....

Example.asp

<%
Dim sUser
Dim sPass

sUser=Request.Form("user")
sPass=Request.Form("pass")
''VALIDATION CODE HERE.......

%>

<form method=post action=Example.asp>
Username:<input name="user" value="<%=sUser%>"><br>
Password:<input name="pass" value="<%=sPass%>"><br>
<input type=submit value="submit">
</form>
Note that the action is set to Example.asp the same name as the current
page.
"r0adhog" <ro*****@nospam.phreaker.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
首先关闭我希望所有那些回复我以前的问题,你b $ b得到很多帮助。

有几个一般性的问题。

为什么每个人都建议不要使用VB客户端脚本?

其次,我决定在处理页面上进行验证。
如果表单上的字段不符合验证规则,我能够
重定向回发送页面。我如何做到这一点,以便发送
页面保留客户以前放入的值,以便他只需要纠正无效的字段?

感谢帮助nuuubeeeee .....

First off wanted to that all that replied to my previous questions, you were much help.

Had a couple of general questions.

Why has everyone suggested not using VB Script on the Client Side?

Secondly, I have decided to do my validation on the processing page.
If a field on the form does not meet the validation rules, I am able to
redirect back to the sending page. How do I do this so that the sending
page retains the values that the Client had previously put in so that he
only
needs to correct the fields that are not valid?

Thanks for helping out the nuuubeeeee.....

rh




" r0adhog" < RO ***** @ nospam.phreaker.net>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...

"r0adhog" <ro*****@nospam.phreaker.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...


因为Internet Explorer是唯一支持它的浏览器。即使你正在内网上工作,并且你知道所有访问者都在使用IE浏览器,但使用VBS仍然是非常不明智的。有一天你的内联网将成为一个外联网,然后你将不得不重新编码。如果你不知道javascript,那就咬紧牙关并学习足够的东西,以获得你需要做的事情。


其次,我决定在处理页面上进行验证。
如果表单上的字段不符合验证规则,我可以
重定向回发送页面。我如何做到这一点,以便发送
页面保留客户以前放入的值,以便他只需要纠正无效的字段?

Why has everyone suggested not using VB Script on the Client Side?
Because Internet Explorer is the only browser that supports it. Even if
you''re working on an intranet and you know that all your visitors are using
IE, it''s still highly ill-advised to use VBS. One day your intranet will
become an extranet, and then you''ll have to recode it all. If you don''t
know javascript, bite the bullet and learn enough to get by with what you
have to do.

Secondly, I have decided to do my validation on the processing page.
If a field on the form does not meet the validation rules, I am able to
redirect back to the sending page. How do I do this so that the sending
page retains the values that the Client had previously put in so that he
only
needs to correct the fields that are not valid?




有很多方法。一种是将表格发布到

它所在的页面上。


form.asp:


<%

如果request.serverVariables(" REQUEST_METHOD")=" POST"然后

'''''做你的事情

结束如果

%>


< form method =" post" action =" form.asp">

< input name =" txtName"

value ="<%= Server.HTMLEncode(Request.Form (" txtName"))%>"类型= QUOT;文本" />

< / form>


如果首次加载表单,REquest.Form(" txtName")将

为空,所以你会得到一个空值。如果表单已经提交并且由于验证失败而重新显示它,那么用户之前在该文本框中输入的
的任何内容都将从表单集合中提取

并显示在其中。

如果你不想发布到同一页面,你可以在

session中设置值变量并从中拉出来。第一种方法比较容易,但是如果没有警告,你最终会得到不能刷新的页面。通过

刷新此页面,您提交的所有数据都将再次发送...或者

无论浏览器警告是什么。


雷在工作



There are a number of ways. One is to post the form to the same page that
it''s on.

form.asp:

<%
If request.serverVariables("REQUEST_METHOD") = "POST" Then
''''''do your thing
End If
%>

<form method="post" action="form.asp">
<input name="txtName"
value="<%=Server.HTMLEncode(Request.Form("txtName" ))%>" type="text" />
</form>

If the form is being loaded for the first time, REquest.Form("txtName") will
be empty, so you''ll have an empty value. If the form has been submitted and
you''re redisplaying it because of failed validation, anything the user had
previously entered in that textbox will be pulled from the form collection
and displayed in it.
If you don''t want to post to the same page, you can set the values in
session variables and pull from them. The first method is easier, but then
you wind up having pages that can''t be refreshed without the "Warning. By
refreshing this page, any data you submitted will be sent again..." or
whatever that browser warning is.

Ray at work


再次感谢大家! br />

rh


" r0adhog" < RO ***** @ nospam.phreaker.net>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
Thanks again folks!

rh

"r0adhog" <ro*****@nospam.phreaker.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
首先关闭我希望所有那些回复我以前的问题,你b $ b得到很多帮助。

有几个一般性的问题。

为什么每个人都建议不要使用VB客户端脚本?

其次,我决定在处理页面上进行验证。
如果表单上的字段不符合验证规则,我能够
重定向回发送页面。我如何做到这一点,以便发送
页面保留客户以前放入的值,以便他只需要纠正无效的字段?

感谢您帮助nuuubeeeee .....

rh
First off wanted to that all that replied to my previous questions, you were much help.

Had a couple of general questions.

Why has everyone suggested not using VB Script on the Client Side?

Secondly, I have decided to do my validation on the processing page.
If a field on the form does not meet the validation rules, I am able to
redirect back to the sending page. How do I do this so that the sending
page retains the values that the Client had previously put in so that he
only
needs to correct the fields that are not valid?

Thanks for helping out the nuuubeeeee.....

rh



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

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