|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
interesting problem...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?
Show quote
Hide quote
"6" <no@spam.com> wrote in message Function GetDefault(Name)news:Oza7Wpg6GHA.4408@TK2MSFTNGP02.phx.gbl... > 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? > > 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.
Show quote
Hide quote
"Anthony Jones" <A**@yadayadayada.com> wrote in message close but doesnt work. it keeps the data even when the verification is news:%23DhVQug6GHA.3384@TK2MSFTNGP05.phx.gbl... > > "6" <no@spam.com> wrote in message > news:Oza7Wpg6GHA.4408@TK2MSFTNGP02.phx.gbl... >> 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? >> >> > > 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. > > > > successful. you should try it out and youll see. anyone else have any ideas?
Show quote
Hide quote
"SLH" <S**@SLH.SLH> wrote in message Yep it were broken here's one that works:-news:uOB2JUt6GHA.2384@TK2MSFTNGP04.phx.gbl... > > "Anthony Jones" <A**@yadayadayada.com> wrote in message > news:%23DhVQug6GHA.3384@TK2MSFTNGP05.phx.gbl... > > > > "6" <no@spam.com> wrote in message > > news:Oza7Wpg6GHA.4408@TK2MSFTNGP02.phx.gbl... > >> 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? > >> > >> > > > > 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 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 %> dude... all due respect, that doesnt even DO anything.
thanks for your help but if youre not going to provide a complete working example id rather give up now Show quoteHide quote "Anthony Jones" <A**@yadayadayada.com> wrote in message news:uvmA8ju6GHA.3452@TK2MSFTNGP05.phx.gbl... > > "SLH" <S**@SLH.SLH> wrote in message > news:uOB2JUt6GHA.2384@TK2MSFTNGP04.phx.gbl... >> >> "Anthony Jones" <A**@yadayadayada.com> wrote in message >> news:%23DhVQug6GHA.3384@TK2MSFTNGP05.phx.gbl... >> > >> > "6" <no@spam.com> wrote in message >> > news:Oza7Wpg6GHA.4408@TK2MSFTNGP02.phx.gbl... >> >> 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? >> >> >> >> >> > >> > 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? > > 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 > %> > > > >> if youre not going to provide a complete working example id rather give What a ridiculous comment!up now I'd suggest that you just give up. You obviously have no aptitude or desire for this, dude. Bob Lehmann Show quoteHide quote "SLH" <S**@SLH.SLH> wrote in message news:OWZrQEv6GHA.3644@TK2MSFTNGP03.phx.gbl... > dude... all due respect, that doesnt even DO anything. > thanks for your help but if youre not going to provide a complete working > example id rather give up now > > > > "Anthony Jones" <A**@yadayadayada.com> wrote in message > news:uvmA8ju6GHA.3452@TK2MSFTNGP05.phx.gbl... > > > > "SLH" <S**@SLH.SLH> wrote in message > > news:uOB2JUt6GHA.2384@TK2MSFTNGP04.phx.gbl... > >> > >> "Anthony Jones" <A**@yadayadayada.com> wrote in message > >> news:%23DhVQug6GHA.3384@TK2MSFTNGP05.phx.gbl... > >> > > >> > "6" <no@spam.com> wrote in message > >> > news:Oza7Wpg6GHA.4408@TK2MSFTNGP02.phx.gbl... > >> >> 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? > >> >> > >> >> > >> > > >> > 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? > > > > 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 > > %> > > > > > > > > "SLH" <S**@SLH.SLH> wrote in message Works fine. Does what you asked. If the input doesn't validate (in thisnews:OWZrQEv6GHA.3644@TK2MSFTNGP03.phx.gbl... > dude... all due respect, that doesnt even DO anything. > thanks for your help but if youre not going to provide a complete working > example id rather give up now > case typing the word 'bad') the form comes back with the data still intact else it comes back blank. Show quoteHide quote > > > "Anthony Jones" <A**@yadayadayada.com> wrote in message > news:uvmA8ju6GHA.3452@TK2MSFTNGP05.phx.gbl... > > > > "SLH" <S**@SLH.SLH> wrote in message > > news:uOB2JUt6GHA.2384@TK2MSFTNGP04.phx.gbl... > >> > >> "Anthony Jones" <A**@yadayadayada.com> wrote in message > >> news:%23DhVQug6GHA.3384@TK2MSFTNGP05.phx.gbl... > >> > > >> > "6" <no@spam.com> wrote in message > >> > news:Oza7Wpg6GHA.4408@TK2MSFTNGP02.phx.gbl... > >> >> 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? > >> >> > >> >> > >> > > >> > 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? > > > > 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 > > %> > > > > > > > >
Show quote
Hide quote
"6" <no@spam.com> wrote in message This is *really* clever. Don't show the form after a successful submission. news:Oza7Wpg6GHA.4408@TK2MSFTNGP02.phx.gbl... >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? It confuses users. -- Mike Brind would be even more clever to read closely. i never said "dont show the
form", clearly what i said was that the data the user just typed should be cleared, which is the default behavior on every form on the web. so, any *clever* ideas? Show quoteHide quote "Mike Brind" <paxton***@hotmail.com> wrote in message news:%23DaUapw6GHA.4352@TK2MSFTNGP05.phx.gbl... > > "6" <no@spam.com> wrote in message > news:Oza7Wpg6GHA.4408@TK2MSFTNGP02.phx.gbl... >>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? > > This is *really* clever. Don't show the form after a successful > submission. It confuses users. > > -- > Mike Brind > I read your post closely enough to wonder why on earth you would want to
present a blank form to users *after* a successful submission. This is *not* the behaviour that most users would expect, which is why you never see any professional site do it. The only time I present a blank form after successful submission is if I expect further submissions from the same user. If you wanted to allow users to make multiple submissions, you would not want to clear their name, address etc. You would retain it, so this is obviously not what you are doing. I suggest you do something new for you - take your head out of your arse and think about it for just one nanosecond. But if you are insistent on showing blank forms, go ahead. Go with Anthony's suggestion to try and understand If... Then... Else. What you want to do is very simply solved with a basic understanding of the construct. In your first post as "Jimmy" you said you have a "client", which suggests you are getting paid to create whatever app it is you are posting about. So far as I can see, you have contributed nothing to it, but relied on people here to do it all for you. Now you have insulted and abused so many of us that no one is prepared to help you any more, so you keep changing your identity. Well, Jimmy/Joe Reynolds/SLH/6/Jim D - you are on your own as far as I am concerned. Good bye. Show quoteHide quote "Jim D" <no@spam.com> wrote in message news:%2393Gn2w6GHA.1560@TK2MSFTNGP04.phx.gbl... > would be even more clever to read closely. i never said "dont show the > form", clearly what i said was that the data the user just typed should be > cleared, which is the default behavior on every form on the web. > > so, any *clever* ideas? > > > "Mike Brind" <paxton***@hotmail.com> wrote in message > news:%23DaUapw6GHA.4352@TK2MSFTNGP05.phx.gbl... >> >> "6" <no@spam.com> wrote in message >> news:Oza7Wpg6GHA.4408@TK2MSFTNGP02.phx.gbl... >>>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? >> >> This is *really* clever. Don't show the form after a successful >> submission. It confuses users. >> >> -- >> Mike Brind >> > > if youre lonely and pathetic enough to care, we work in teams of 2
developers, and share a dev station. rarely does anyone care enoguh to change the name on the OE profile used for posting, hence the several names. and one other thing... "arse"? Show quoteHide quote "Mike Brind" <paxton***@hotmail.com> wrote in message news:O6rh%23Ex6GHA.4996@TK2MSFTNGP03.phx.gbl... >I read your post closely enough to wonder why on earth you would want to >present a blank form to users *after* a successful submission. This is >*not* the behaviour that most users would expect, which is why you never >see any professional site do it. The only time I present a blank form >after successful submission is if I expect further submissions from the >same user. If you wanted to allow users to make multiple submissions, you >would not want to clear their name, address etc. You would retain it, so >this is obviously not what you are doing. I suggest you do something new >for you - take your head out of your arse and think about it for just one >nanosecond. > > But if you are insistent on showing blank forms, go ahead. Go with > Anthony's suggestion to try and understand If... Then... Else. What you > want to do is very simply solved with a basic understanding of the > construct. > > In your first post as "Jimmy" you said you have a "client", which suggests > you are getting paid to create whatever app it is you are posting about. > So far as I can see, you have contributed nothing to it, but relied on > people here to do it all for you. Now you have insulted and abused so > many of us that no one is prepared to help you any more, so you keep > changing your identity. > > Well, Jimmy/Joe Reynolds/SLH/6/Jim D - you are on your own as far as I am > concerned. > > Good bye. > > "Jim D" <no@spam.com> wrote in message > news:%2393Gn2w6GHA.1560@TK2MSFTNGP04.phx.gbl... >> would be even more clever to read closely. i never said "dont show the >> form", clearly what i said was that the data the user just typed should >> be cleared, which is the default behavior on every form on the web. >> >> so, any *clever* ideas? >> >> >> "Mike Brind" <paxton***@hotmail.com> wrote in message >> news:%23DaUapw6GHA.4352@TK2MSFTNGP05.phx.gbl... >>> >>> "6" <no@spam.com> wrote in message >>> news:Oza7Wpg6GHA.4408@TK2MSFTNGP02.phx.gbl... >>>>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? >>> >>> This is *really* clever. Don't show the form after a successful >>> submission. It confuses users. >>> >>> -- >>> Mike Brind >>> >> >> > >
Other interesting topics
call store procedure for inserting data in asp
Problem with asp page returning a jpg image... Export data to Excel How to collect uncertain number of people information in a form How expensive is object instantication? SMTP how can i detect multiplt VBNewLine's in a row 3-factor login system Random GUID type number or RegExp Jet Database Error |
|||||||||||||||||||||||