|
 |
asp_web_howto thread: How to retain a form's contents after it gets refreshed
Message #1 by "sastry o" <sastry_sa@y...> on Sat, 28 Apr 2001 13:52:42
|
|
Sir,
I have developed an ASP application which has a few forms and these
forms have different controls like text boxes, select lists etc. When a
user enters some data and submits it the control passes to another ASP
page in which certain validations are done and if it doesn't conform to
the rules an error message gets displayed. It also displays a hyperlink to
the form.
When the link is clicked the form gets displayed again i.e. the page gets
refreshed but it will not retain the values that were entered. I would
like to refresh the page with the data i.e I want to retain the values
that were entered.
How to do it in ASP. I am using VBScript for the Server side scripting.
I shall be grateful to you if you send me the solution at the earliest.
regards
O.Patanjali Sastry
Message #2 by Imar Spaanjaars <Imar@S...> on Sun, 29 Apr 2001 12:13:13 +0200
|
|
At the earliest???? Hmmmmmmmm.................
Anyway, the simplest way to do is, is to make a self posting form. That is
a form that has itself as the target. Then use the Request.Form("value") to
fill in the fields again.
Here is a short example:
(Make sure you change thisPage.asp to the name of this page)
<%
' If form was submitted then
' Validation goes here
' end if
%>
<form name="frmTest" id="frmTest" method="post" target="thisPage.asp">
<input type="text" name="txtName" id="txtName"
value="<%=Request.Form("txtName")%>>
<input type="submit" value="Submit">
</form>
The first time this form is shown, Request.Form("txtName") does not have a
value yet, so the input box will be blank. When the user fills in the text
box and presses submit, the form will be posted to itself. The validation
is run, and then the form is shown again (in case of an error). Now
Request.Form("txtName") does have a value, so it's filled in again.
This is just a simple example, but it will show you the principle.
Hope this helps,
Imar
At 01:52 PM 4/28/2001 +0000, you wrote:
>Sir,
>
> I have developed an ASP application which has a few forms and these
>forms have different controls like text boxes, select lists etc. When a
>user enters some data and submits it the control passes to another ASP
>page in which certain validations are done and if it doesn't conform to
>the rules an error message gets displayed. It also displays a hyperlink to
>the form.
>
> When the link is clicked the form gets displayed again i.e. the page gets
>refreshed but it will not retain the values that were entered. I would
>like to refresh the page with the data i.e I want to retain the values
>that were entered.
>
> How to do it in ASP. I am using VBScript for the Server side scripting.
>
> I shall be grateful to you if you send me the solution at the earliest.
>
> regards
>O.Patanjali Sastry
Message #3 by Imar@S... on Sun, 29 Apr 2001 12:22:08
|
|
Ooops, little mistake.
target="thisPage.asp">
should of course be:
action="thisPage.asp">
(must be sunday morning ;-) )
Imar
> At the earliest???? Hmmmmmmmm.................
>
>
> Anyway, the simplest way to do is, is to make a self posting form. That
is
> a form that has itself as the target. Then use the Request.Form("value")
to
> fill in the fields again.
>
> Here is a short example:
>
>
> (Make sure you change thisPage.asp to the name of this page)
> <%
> ' If form was submitted then
> ' Validation goes here
> ' end if
>
> %>
>
> <form name="frmTest" id="frmTest" method="post" target="thisPage.asp">
>
> <input type="text" name="txtName" id="txtName"
> value="<%=Request.Form("txtName")%>>
> <input type="submit" value="Submit">
>
> </form>
>
>
> The first time this form is shown, Request.Form("txtName") does not have
a
> value yet, so the input box will be blank. When the user fills in the
text
> box and presses submit, the form will be posted to itself. The
validation
> is run, and then the form is shown again (in case of an error). Now
> Request.Form("txtName") does have a value, so it's filled in again.
>
>
> This is just a simple example, but it will show you the principle.
>
> Hope this helps,
>
> Imar
>
>
> At 01:52 PM 4/28/2001 +0000, you wrote:
> >Sir,
> >
> > I have developed an ASP application which has a few forms and
these
> >forms have different controls like text boxes, select lists etc. When a
> >user enters some data and submits it the control passes to another ASP
> >page in which certain validations are done and if it doesn't conform to
> >the rules an error message gets displayed. It also displays a hyperlink
to
> >the form.
> >
> > When the link is clicked the form gets displayed again i.e. the page
gets
> >refreshed but it will not retain the values that were entered. I would
> >like to refresh the page with the data i.e I want to retain the values
> >that were entered.
> >
> > How to do it in ASP. I am using VBScript for the Server side
scripting.
> >
> > I shall be grateful to you if you send me the solution at the
earliest.
> >
> > regards
> >O.Patanjali Sastry
>
Message #4 by "Walter Franssen" <walter@w...> on Sun, 29 Apr 2001 12:11:16
|
|
Try it with JavaScript:history.back()
Message #5 by vinay.poddar@s... on Mon, 30 Apr 2001 12:19:10 +0530
|
|
Hi,
You make A FORM WITH some hidden object and make a function to initialize hidden
objects while submiting , submit the form having hidden objects to another asp.
Hope this help
Vinay
Message #6 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Mon, 30 Apr 2001 10:38:04 +0100
|
|
save the form values in an array stored in the session object
-----Original Message-----
From: sastry o [mailto:sastry_sa@y...]
Sent: Saturday, April 28, 2001 2:53 PM
To: ASP Web HowTo
Subject: [asp_web_howto] How to retain a form's contents after it gets
refreshed
Sir,
I have developed an ASP application which has a few forms and these
forms have different controls like text boxes, select lists etc. When a
user enters some data and submits it the control passes to another ASP
page in which certain validations are done and if it doesn't conform to
the rules an error message gets displayed. It also displays a hyperlink to
the form.
When the link is clicked the form gets displayed again i.e. the page gets
refreshed but it will not retain the values that were entered. I would
like to refresh the page with the data i.e I want to retain the values
that were entered.
How to do it in ASP. I am using VBScript for the Server side scripting.
I shall be grateful to you if you send me the solution at the earliest.
regards
O.Patanjali Sastry
|
|
 |