473,320 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Richard Mueller... you out there?

Hi Richard. You've helped me out in the past so I thought I'd present you
with the latest problem that we can't seem to fix.

Consider an ASP page with a form that has a few text fields... name,
address, comments etc. The page posts to itself so we have the usual line
that says:

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then

If the users input passes various validations we write it to a database and
display a thank you message below the form. The problem is when a validation
fails. When that happens we display a sorry, try again kind of message, but
the problem is that the page refreshes and the users data that they typed in
is cleared form the text boxes. We want the data to persist until the form
is successfully submitted, then it can clear (because this is what a user
expects when the form is submitted. If the data persisted after success,
they would get confused and probably resubmit it)

We've tried different functions in conjunction with setting the default
value of the text boxes to:
<%= Request.Form("textboxname") %>, but the best we can get is for the data
to persist, regardless of whether the submission is good or not.

Is there anything clever you can come up with? If I have to I can put an
example on the web.

Thank you!
Oct 8 '06 #1
2 1351

"Jim D" <no@spam.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
Hi Richard. You've helped me out in the past so I thought I'd present you
with the latest problem that we can't seem to fix.

Consider an ASP page with a form that has a few text fields... name,
address, comments etc. The page posts to itself so we have the usual line
that says:

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then

If the users input passes various validations we write it to a database
and
display a thank you message below the form. The problem is when a
validation
fails. When that happens we display a sorry, try again kind of message,
but
the problem is that the page refreshes and the users data that they typed
in
is cleared form the text boxes. We want the data to persist until the form
is successfully submitted, then it can clear (because this is what a user
expects when the form is submitted. If the data persisted after success,
they would get confused and probably resubmit it)

We've tried different functions in conjunction with setting the default
value of the text boxes to:
<%= Request.Form("textboxname") %>, but the best we can get is for the
data
to persist, regardless of whether the submission is good or not.

Is there anything clever you can come up with? If I have to I can put an
example on the web.

Thank you!
This works:-

<%

Dim mbFailed : mbFailed = True

If Request.ServerVariables("REQUEST_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's same as the other one I posted only it uses the more tranditional
REQUEST_METHOD instead of HTTP_METHOD which are actually the same thing. ;)

Oct 9 '06 #2
SLH
got it working. thanks everyone

"Anthony Jones" <An*@yadayadayada.comwrote in message
news:ex**************@TK2MSFTNGP02.phx.gbl...
>
"Jim D" <no@spam.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>Hi Richard. You've helped me out in the past so I thought I'd present you
with the latest problem that we can't seem to fix.

Consider an ASP page with a form that has a few text fields... name,
address, comments etc. The page posts to itself so we have the usual line
that says:

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then

If the users input passes various validations we write it to a database
and
>display a thank you message below the form. The problem is when a
validation
>fails. When that happens we display a sorry, try again kind of message,
but
>the problem is that the page refreshes and the users data that they typed
in
>is cleared form the text boxes. We want the data to persist until the
form
is successfully submitted, then it can clear (because this is what a user
expects when the form is submitted. If the data persisted after success,
they would get confused and probably resubmit it)

We've tried different functions in conjunction with setting the default
value of the text boxes to:
<%= Request.Form("textboxname") %>, but the best we can get is for the
data
>to persist, regardless of whether the submission is good or not.

Is there anything clever you can come up with? If I have to I can put an
example on the web.

Thank you!

This works:-

<%

Dim mbFailed : mbFailed = True

If Request.ServerVariables("REQUEST_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's same as the other one I posted only it uses the more tranditional
REQUEST_METHOD instead of HTTP_METHOD which are actually the same thing.
;)

Oct 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Andy Turner | last post by:
I'm thinking of buying this book because I like the angle it's coming from and I found his previous DCOM book more enlightening than most. The thing is, it's 18 months old now (an age in .NET...
2
by: Prabal | last post by:
I hate to raise this matter now. I want to know Richard W. Stevens's cause of death. I am just curious. He was just 48. His books are very inspiring. I couldn't find the answer.
5
by: Chua Wen Ching | last post by:
Hi there, Sorry for the late reply. I was busy attending Microsoft Teched 2004 Malaysia. Oh i didn't know you can set off the security in CAS. Sigh! on install you could have an encrypted...
1
by: Les Buchanan | last post by:
I'm trying to figure out why the script that Richard Cornford wrote to scroll a table loses the column headers when you add a row header. For example: <table> <tr> <th>Name</th>...
12
by: whitehatmiracle | last post by:
Dear Sir I couldnt quite figure out wat your permute function does exactly... could you please throw some light on it? void Permute(char *Perm, size_t n, size_t unchanged) { size_t outer = 0;...
4
by: Joonshik Kim | last post by:
I was trying to define 3d array with pointer to pointer. I wrote like following. int ***d; nx = 3; ny = 5; nz = 4; d = (int ***)malloc((int) nx*sizeof(int **)); *d = (int **)malloc((int)...
17
by: sophia.agnes | last post by:
Hi , I was going through peter van der linden's book Expert C programming, in this book there is a section named "How and why to cast" the author then says as follows (float) 3 - it's a...
43
by: sophia.agnes | last post by:
Hi, I was going through Mr "Richard heathfields" site , it is written as follows:- Some people think C has no role to play in the modern programming world. I would consider this opinion to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.