473,395 Members | 1,763 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,395 software developers and data experts.

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

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>

Oct 1 '05 #1
4 9874
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
<ka***********@yahoo.com> wrote in message
news:11*********************@o13g2000cwo.googlegro 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>

Oct 1 '05 #2
Many Thanks Ray

Karen

Oct 2 '05 #3
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

Oct 3 '05 #4
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

<ka***********@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr 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

Oct 4 '05 #5

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

Similar topics

7
by: M | last post by:
i have a form which i would like to input different "action" url depending on the button that was clicked. is there a way that javascript can prefill a defined action based on the button...
6
by: millw0rm | last post by:
i got a form full of radio buttons appx. 60-70, depends on the page. Some times 60, sometimes 55.... After certain period of time, i want to disable or make readonly all the radio button inside the...
3
by: nkoriginal | last post by:
Hello: I tried an script for keep my data form after reload page, but I've some errors. In this momento I runnung my own browser because we've an intranet. And for security reason, our page...
7
kvijayhari
by: kvijayhari | last post by:
hi i'm having a form in which a text field has a js function which lists the name of the customer by searching the letters typed in the field.. (like the one on gmail mail to column) The js...
4
by: billa856 | last post by:
Hi, My project is in MS Access. In that I have one Form(DataEntry) which I am using for entering data into the Table(PRODUCTION). Now after entering data in Textboxes when I click on...
4
by: raknin | last post by:
Hi, I have a list that I want every time the list is changed I want to change other elemnets in the form automatically without pressing any submit button, for example an update second list. All...
1
by: arggg | last post by:
I created a submit form that calls a javascript:AjAX Command that will call the data and submit it without have the page refresh. This works perfect in Firefox however in IE and Opera when the...
5
oranoos3000
by: oranoos3000 | last post by:
hi I want to send value of textbox without using form tag and submit button to another page? Is it possible with php ? How do I get this thing work? thanks alot
4
by: velocity00723 | last post by:
I am trying to login for website with autologin to forum,and vcalender its work fine in mozilla and ie but it gives problem in safari(IN MAC) following is the code if(isset($_POST)) {...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.