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

Returning to a form

Hello I hope someone can help me.

I have a form page a user needs to fill out. I want to be
able to send the user back to the form once it is
submitted and an error in processing occurs, for example
if they have an illigal charcter in the form somewhere.
The whole form wouldn't need to be retyped, just the
field in question.

How can I send the user back to the form they just
submitted to correct an entry?
Jul 19 '05 #1
1 1327
I assume that you are not posting back to the same page, huh? You can use
session variables then, as such. You could also use a querystring, but I
find that to get messy and less than ideal. Here's a simple example:
page1.asp:

<%
Dim aErrors(1)
aErrors(0) = ""
aErrors(1) = "Your username may not contain a space."
sUsername = Session("Username")
Session.Contents.Remove("Username")
iErrorID = CInt(Request.Querystring("e"))
%>
<form method="post" action="page2.asp">
<table>
<% If iErrorID > 0 Then %>
<tr>
<td colspan="2"><%=aErrors(iErrorID)%></td>
</tr>
<% End If %>
<tr>
<td>Pick a username</td>
<td><input name="txtUsername" type="text" value="<%=sUsername%>" />
</tr>

<tr>
<td colspan="2" align="right"><input type="submit" /></td>
</tr>
</table>
</form>
page2.asp:

<%
Dim sUsername
sUsername = Trim(Request.Form("txtUsername"))
If Instr(sUsername, " ") > 0 Then
Session("Username") = sUsername
Response.Redirect "page1.asp?e=1"
Else
Session.Contents.Remove("Username")
Response.Write "The username that you entered, " & sUsername & " does not
contain any spaces. Good job."
End If
%>

Ray at home

"Stewart" <st************@hp.com> wrote in message
news:00****************************@phx.gbl...
Hello I hope someone can help me.

I have a form page a user needs to fill out. I want to be
able to send the user back to the form once it is
submitted and an error in processing occurs, for example
if they have an illigal charcter in the form somewhere.
The whole form wouldn't need to be retyped, just the
field in question.

How can I send the user back to the form they just
submitted to correct an entry?

Jul 19 '05 #2

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

Similar topics

2
by: Mountain Man | last post by:
Hi, I'm having trouble with the foreach function. I'm using it twice inside a user defined function with two different arrays, and in the second instance it's returning the value of the first...
7
by: Peter Adolphs | last post by:
Hi newsgroup! The W3C HTML 4.01 recommendation states that "The onreset event occurs when a form is reset." Using Mozilla 1.4.1, how come that if I set onreset="return false;", the form is not...
2
by: lmeng | last post by:
Hi, I am new to this Forum. Thanks in advance for any kind help. In the following HTML code, when I change the value of one text field then click "Modify" button, if the validation fails a...
3
by: Skippytpe | last post by:
Does anyone have an idea why the form validation in the following page wouldn't be working? I had been using XHTML 1.0 transitional which allowed me to use the form attribute 'name.' I could then...
8
by: Arthur Rusdell-Wilson | last post by:
I find that in a large form (especially if there is a table within the form?) that the form is submitted to my server-side script even when a JavaScript 'onsubmit' event handler returns 'false'. ...
2
by: neptune | last post by:
I built a form to access a query with a 2 field primary key. It should use 2 controls to find the unique record and display the other field values on the form. In the criteria section of the...
1
by: John Chorlton | last post by:
I've been attempting to pass a chunk of data back from a child Windows form using public properties on the form and have been getting some odd errors. I wanted to return a row of data to avoid...
8
by: Doug Lerner | last post by:
I have this snippet of client side code running: var makeField = document.forms; alert("makeFieldName name,length,type=" + makeFieldName + ", " + makeField.name + "," + makeField.length + ","...
0
by: pradeepap | last post by:
Hi, I am trying to return a form value from within a msxsl script. Please help me if i am doing it wrong. the code is as follows. <msxsl:script language="javascript" implements-prefix="user"> ...
2
by: saneman | last post by:
I have this function: int getBeer(){ std::cout << "drunk\n"; } when I compile with g++ I don't get any error or warning. Why?
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.