有趣的问题...... [英] interesting problem...

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

问题描述

我有一个带有表格的asp页面,收集姓名,电子邮件地址等

表单页面发布给自己,所以我做的是检查请求方法是否

是POST,如果是,我抓取数据,用它做一些事情,并在表单下方显示

消息。我想实现一个图像验证(captcha)

系统。我遇到的问题是,当您提交表格时,如果验证码

测试失败,您输入表格的所有信息都将被清除,用户必须重新开始使用
。我希望信息保持不变,直到表格成功提交

。现在,我可以将文本字段的默认值设置为

request.form(" fieldname"),但这里的问题是我想要的信息

提交表单时清除(用户已经习惯了这种情况,并且如果数据在提交完成后保留在表单中,则会被混淆)


我能在这里做些什么聪明的事吗?

I have an asp page with a form that collects name, email address, etc. the
form page posts to itself so what I do is check to see if the request method
is POST and if it is I grab the data, do something with it, and display a
message below the form. I want to implement an image verification (captcha)
system. the problem I have is that when you submit the form if the captcha
test fails, all the info you entered into the form is cleared and the user
has to start over. I want the info to stay until the form is successfully
submitted. now, I can set the default value of the text fields to
request.form("fieldname"), but the problem here is that I WANT the info to
be cleared when the form is submitted (users are used to this happening and
if the data stays in the form after a good submission they will be confused)

is there something clever I can do here?

推荐答案



" 6" < no@spam.com写了留言

新闻:Oz ************** @ TK2MSFTNGP02.phx.gbl ...

"6" <no@spam.comwrote in message
news:Oz**************@TK2MSFTNGP02.phx.gbl...

我有一个带有表格的asp页面,收集姓名,电子邮件地址等

表单页面发布给自己,所以我要做的是检查是否请求
I have an asp page with a form that collects name, email address, etc. the
form page posts to itself so what I do is check to see if the request



方法

method


是POST,如果是,我抓取数据,用它做点什么,并在表单下方显示

消息。我想实现图像验证
is POST and if it is I grab the data, do something with it, and display a
message below the form. I want to implement an image verification



(验证码)

(captcha)


系统。我遇到的问题是,当您提交表格时,如果验证码

测试失败,您输入表格的所有信息都将被清除,用户必须重新开始使用
。我希望信息保持不变,直到表格成功提交

。现在,我可以将文本字段的默认值设置为

request.form(" fieldname"),但这里的问题是我想要的信息

在提交表单时清除(用户习惯于这种情况发生)
system. the problem I have is that when you submit the form if the captcha
test fails, all the info you entered into the form is cleared and the user
has to start over. I want the info to stay until the form is successfully
submitted. now, I can set the default value of the text fields to
request.form("fieldname"), but the problem here is that I WANT the info to
be cleared when the form is submitted (users are used to this happening




and


如果数据在提交完成后保留在表单中,他们将是
if the data stays in the form after a good submission they will be



confused)

confused)


>

有什么聪明的我可以在这里做吗?

>
is there something clever I can do here?



函数GetDefault(名称)

如果mbFailed那么

GetDefault = Server.HTMLEncode(Request.Form(Name))

结束如果

结束功能


< input value ="<%= GetDefault(" field1")%name =" field1" />


我建议你让自己熟悉VBScript语言

这样的结构如If Else End If和Function有时非常有用。


Function GetDefault(Name)
If mbFailed Then
GetDefault = Server.HTMLEncode(Request.Form(Name))
End If
End Function

<input value="<%=GetDefault("field1")% name="field1" />

I would recommend that you make yourself familar with the VBScript language
such constructs as If Else End If and Function are really useful sometimes.





" Anthony Jones" < An*@yadayadayada.com写信息

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

"Anthony Jones" <An*@yadayadayada.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

>

" 6" < no@spam.com写了留言

新闻:Oz ************** @ TK2MSFTNGP02.phx.gbl ...
>
"6" <no@spam.comwrote in message
news:Oz**************@TK2MSFTNGP02.phx.gbl...

>我有一个asp页面,其中包含一个收集姓名,电子邮件地址等的表单。
表单页面发布到自身,所以我要做的就是查看如果请求
>I have an asp page with a form that collects name, email address, etc.
the
form page posts to itself so what I do is check to see if the request



方法

method


>是POST,如果是我抓取数据,那么带有它的东西,并在表格下面显示一条消息。我想实现图像验证
>is POST and if it is I grab the data, do something with it, and display a
message below the form. I want to implement an image verification



(验证码)

(captcha)


>系统。我遇到的问题是,当你提交表格时,如果
验证码测试失败,你输入表格的所有信息都会被清除,
用户必须重新开始。我希望信息保持不变,直到表单成功提交。现在,我可以将文本字段的默认值设置为
request.form(" fieldname"),但这里的问题是我想要清除信息

提交表单(用户习惯这种情况发生
>system. the problem I have is that when you submit the form if the
captcha
test fails, all the info you entered into the form is cleared and the
user
has to start over. I want the info to stay until the form is successfully
submitted. now, I can set the default value of the text fields to
request.form("fieldname"), but the problem here is that I WANT the info
to
be cleared when the form is submitted (users are used to this happening




and


>如果数据保持在提交完成后的表格将为
>if the data stays in the form after a good submission they will be



confused)

confused)


>>
有什么聪明的我可以在这里做吗?

>>
is there something clever I can do here?



函数GetDefault(名称)

如果mbFailed那么

GetDefault = Server.HTMLEncode(Request.Form(Name))

结束如果

结束功能


< ;输入值="<%= GetDefault(" field1")%name =" field1" />


我建议你自己熟悉VBScript

语言

如If Else End If这样的结构和函数非常有用

有时候。


Function GetDefault(Name)
If mbFailed Then
GetDefault = Server.HTMLEncode(Request.Form(Name))
End If
End Function

<input value="<%=GetDefault("field1")% name="field1" />

I would recommend that you make yourself familar with the VBScript
language
such constructs as If Else End If and Function are really useful
sometimes.



关闭但不起作用。即使验证成功,它也会保留数据。你应该尝试一下,你会看到。

其他人有什么想法吗?

close but doesnt work. it keeps the data even when the verification is
successful. you should try it out and youll see.
anyone else have any ideas?




" SLH" < SL*@SLH.SLHwrote in message

news:uO ************** @ TK2MSFTNGP04.phx.gbl ...

"SLH" <SL*@SLH.SLHwrote in message
news:uO**************@TK2MSFTNGP04.phx.gbl...

>

" Anthony Jones" < An*@yadayadayada.com写信息

新闻:%2 **************** @ TK2MSFTNGP05.phx.gbl ...
>
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...


" 6" < no@spam.com写了留言

新闻:Oz ************** @ TK2MSFTNGP02.phx.gbl ...

"6" <no@spam.comwrote in message
news:Oz**************@TK2MSFTNGP02.phx.gbl...

我有一个asp页面,其中包含一个收集姓名,电子邮件地址等的表格。



表单页面发布给自己所以什么我做的是检查是否请求
I have an asp page with a form that collects name, email address, etc.
the
form page posts to itself so what I do is check to see if the request



方法

method


是POST,如果是我抢数据,用它做一些事情,并显示
is POST and if it is I grab the data, do something with it, and display



a

a


消息。我想实现图像验证
message below the form. I want to implement an image verification



(验证码)

(captcha)


系统。我遇到的问题是,当您提交表格时,如果

验证码

测试失败,您输入表格的所有信息都会被清除并且

用户

必须重新开始。我希望信息保持不变,直到表格为
system. the problem I have is that when you submit the form if the
captcha
test fails, all the info you entered into the form is cleared and the
user
has to start over. I want the info to stay until the form is



成功

successfully


已提交。现在,我可以将文本字段的默认值设置为

request.form(" fieldname"),但这里的问题是我想要的信息

to

在表单提交时被清除(用户习惯这种情况发生了
submitted. now, I can set the default value of the text fields to
request.form("fieldname"), but the problem here is that I WANT the info
to
be cleared when the form is submitted (users are used to this happening




and


如果数据在提交良好后保留在表格中,则为
if the data stays in the form after a good submission they will be



confused)

confused)


>

我能在这里做些什么聪明的事吗?

>
is there something clever I can do here?



函数GetDefault(Name)

如果mbFailed那么

GetDefault = Server.HTMLEncode(Request.Form(Name))

结束如果

结束函数


< input value ="<%= GetDefault(" field1")%name =" field1" />


我建议你自己熟悉VBScript

语言

如If Else End If这样的结构和函数非常有用

有时候。


Function GetDefault(Name)
If mbFailed Then
GetDefault = Server.HTMLEncode(Request.Form(Name))
End If
End Function

<input value="<%=GetDefault("field1")% name="field1" />

I would recommend that you make yourself familar with the VBScript
language
such constructs as If Else End If and Function are really useful
sometimes.




关闭但不起作用。即使验证成功,它也会保留数据。你应该尝试一下,你会看到。

其他人有什么想法吗?

close but doesnt work. it keeps the data even when the verification is
successful. you should try it out and youll see.
anyone else have any ideas?



是的,它在这里打破了'有效的一个: -


<%


Dim mbFailed:mbFailed = True

如果Request.ServerVariables(" HTTP_METHOD")=" POST"然后

mbFailed = LCase(Request.Form(" field1"))<" bad"

结束如果


%>

< html>

< body>

< form method =" POST" action =" test.asp">

< input name =" field1"值= QUOT;<%= GetDefault(QUOT; field1的")%GT;" />

< input type =" submit"值= QUOT;邮政" />

< / body>

< / html>

<%

函数GetDefault (姓名)

如果不是mbFailed那么

GetDefault = Server.HTMLEncode(Request.Form(Name))

结束如果

结束功能

%>

Yep it were broken here''s one that works:-

<%

Dim mbFailed : mbFailed = True

If Request.ServerVariables("HTTP_METHOD") = "POST" Then
mbFailed = LCase(Request.Form("field1")) <"bad"
End If

%>
<html>
<body>
<form method="POST" action="test.asp">
<input name="field1" value="<%=GetDefault("field1")%>" />
<input type="submit" value="Post" />
</body>
</html>
<%
Function GetDefault(Name)
If Not mbFailed Then
GetDefault = Server.HTMLEncode(Request.Form(Name))
End If
End Function
%>


这篇关于有趣的问题......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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