View Full Version : asp form question

05-01-2006, 07:56 PM
I DON'T need a php solution, or anything else, other than an html, asp, or javascript solution to this question.

When a user fills out a form, I need to allow them to go back with the fields they already filled out, STILL HAVING THE DATA THERE, to finish filling out remaining fields that were required, but which they overlooked.
This eliminates them having to start all over again.

Thanks in advance.

05-02-2006, 11:34 AM
When I do this I just code a bit of asp that checks the required fields are entered, if not, I get the <body> tag to run off of javascript function to return to the previous page, eg.

Dim goBack
If Request.Form("requiredField")="" Then
End If

Dim onloadAction
If goBack Then
onloadAction=" onLoad='retry()'"
End If

<script language="javascript">
function retry() {
alert('Please ensure all required fields are completed! ');

<body <%=onloadAction%>>

Hope that helps.

05-02-2006, 01:52 PM
Hi Steve,

add a value attribute with a little ASP to the form inputs you want 'remebered'

<input name="somename" value="<%= Request.Form("somename") %>" />

05-02-2006, 03:37 PM
As above, the easiest way it to post a form to itsself then you have the Request.Form collection available.

If Len(Request.Form) > 0 Then
If Request.Form("name") = "" Then
errMsg = errMsg & "- Name is required<br>"
End If

If Request.Form("message") = "" Then
errMsg = errMsg & "- Message is required<br>"
End If

If Len(errMsg) > 0 Then
errMsg = "Error: There was a problem with your form submittal<br>" & errMsg
End If
End If
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>

<span style="color: red"><%=errMsg%></span>
<form name="form1" method="post" action="">
<input type="text" name="name" value="<%=Request.Form("name")%>">
<textarea name="message"><%=Request.Form("message")%></textarea>
<input type="submit" name="Submit" value="Submit">