Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to keep the data in the form fields visible after the submit button is pressed

Reply
Thread Tools

How to keep the data in the form fields visible after the submit button is pressed

 
 
karenmiddleol@yahoo.com
Guest
Posts: n/a
 
      10-01-2005
I have the following form the user enters the From and to period and
presses the Submit button and the form fields are cleared once the
submit button is pressed.

Is there a way I can keep the Form fields visible and not cleared.

Also when I display the message I want the original form cleared in a
different version of this page how can I clear the form completely when
I display the data entered from the Response statements I do not want
the form fields or the submit button visible anymore just the response
statements.

Your help is deeply appreciated.

Thanks
Karen

<html>
<body>
<form method="post" action="pForm.asp">
>From Period : <input type="text" name="FromPeriod"><br>

To Period : <input type="text" name="ToPeriod">
<input type="submit" value="Submit" action = "Go">
</form>
<%
'// Check the first field only (assumes it is required)
If Request.Form("FromPeriod") <> "" Then
Response.Write "From: " & Request.Form("FromPeriod") & "<br>"
Response.Write "To: " & Request.Form("ToPeriod")
End If
%>
</body>

 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-01-2005
The easy way to redisplay form values is to just do <input name="x"
value="<%=Request.Form("x")%>" />

<%
Dim bShowForm : bShowForm = True

''put your code here that would decide if the form should be shown or not.
''If it shouldn't be, set bShowForm to false.

'' What's action="go"?
%>

<html>
<body>
<% If bShowForm Then %>
<form method="post" action="pForm.asp">
>From Period : <input type="text" name="FromPeriod"
>value="<%=Server.HtmlEncode(Request.Form("FromPer iod"))%>"><br>

To Period : <input type="text" name="ToPeriod"
value="<%=Server.HtmlEncode(Request.Form("ToPeriod "))%>">>
<input type="submit" value="Submit" action = "Go">
</form>
<% End If %>
<%
'// Check the first field only (assumes it is required)
If Request.Form("FromPeriod") <> "" Then
Response.Write "From: " & Request.Form("FromPeriod") & "<br>"
Response.Write "To: " & Request.Form("ToPeriod")
End If
%>
</body>

Ray at home


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
>I have the following form the user enters the From and to period and
> presses the Submit button and the form fields are cleared once the
> submit button is pressed.
>
> Is there a way I can keep the Form fields visible and not cleared.
>
> Also when I display the message I want the original form cleared in a
> different version of this page how can I clear the form completely when
> I display the data entered from the Response statements I do not want
> the form fields or the submit button visible anymore just the response
> statements.
>
> Your help is deeply appreciated.
>
> Thanks
> Karen
>
> <html>
> <body>
> <form method="post" action="pForm.asp">
>>From Period : <input type="text" name="FromPeriod"><br>

> To Period : <input type="text" name="ToPeriod">
> <input type="submit" value="Submit" action = "Go">
> </form>
> <%
> '// Check the first field only (assumes it is required)
> If Request.Form("FromPeriod") <> "" Then
> Response.Write "From: " & Request.Form("FromPeriod") & "<br>"
> Response.Write "To: " & Request.Form("ToPeriod")
> End If
> %>
> </body>
>



 
Reply With Quote
 
 
 
 
karenmiddleol@yahoo.com
Guest
Posts: n/a
 
      10-02-2005
Many Thanks Ray

Karen

 
Reply With Quote
 
karenmiddleol@yahoo.com
Guest
Posts: n/a
 
      10-03-2005
Hi Ray

Sorry, another clarification when I set
Dim bShowForm : bShowForm = False

even the form fields disappear for the first time.

Can I dynamically have a button when the user presses it the form
fields can be cleared of
the page and when it is pressed again the form fields appears again.

Thanks
Karen

 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-04-2005
Sure, maybe something like.
<%
Dim bShowForm
bShowForm = CBool(Request.Querystring("showform"))
%>


<a href="thispage.asp?showform=<%=Abs(CInt(Not bShowForm))%>">click</a>

<% If bShowForm Then %>
put form here
<% End If %>


Or just do it with javascript.

Ray at work

p.s. Not posted to
microsoft.public.inetserver.asp,microsoft.public.i netserver.asp.db,microsoft.public.inetserver.asp.f aq
http://www.aspfaq.com/5004



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Hi Ray
>
> Sorry, another clarification when I set
> Dim bShowForm : bShowForm = False
>
> even the form fields disappear for the first time.
>
> Can I dynamically have a button when the user presses it the form
> fields can be cleared of
> the page and when it is pressed again the form fields appears again.
>
> Thanks
> Karen
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
GridView - After submit, want to keep selected row visible Jason ASP .Net 1 12-14-2009 01:49 PM
2 button form + which button was pressed Bill_W_Stephens@yahoo.com Javascript 1 04-04-2006 04:25 AM
submit the form data to the popup window without a submit button jrefactors@hotmail.com HTML 2 01-01-2005 06:07 AM
If value in name field in top row disable submit button until add button is pressed or field is cleared. Chuck Javascript 0 11-10-2003 02:23 AM



Advertisments