Form error (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


xterradane -> Form error (2/5/2002 10:16:47)

I have a form (Registration.asp)and when it is submitted (Add.asp) it checks a couple of fields for validation. If it is incorrect it sends the person back to the form telling them something was wrong. I want to be able to fill in the fields with what they had previously did. I would prefer to not use Sessions either.

Thanks,
Gail

 




rdouglass -> RE: Form error (2/5/2002 12:30:02)

How does it go back to the page? Does it do a POST, a "JavaScript:onClick=history.go(-1)", or what.

If you're using JavaScript, you should be able to pass values back using a querystring; something like:

<head>
<SCRIPT type="text/javascript" language="JavaScript">
<!--
function back_up(url) {
window.location(url);
}
// -->
</SCRIPT>
</head>
<body>
(Your form validation code)

<% IF validation_fail THEN %>
<SCRIPT language="JavaScript">
back_up('myFormPage.asp?Field1=<%=Request.Form("Field1")%>&Field2=<%=Request.Form("Field2")%>')
</script>
<%END IF%>
</body>

Now this will involve defaulting your form fields on the form page by doing something like:

<input type="text" name="Field1" size="20" value="<%=Request.Querystring("Field1")%>>

Does that make sense?? At least, that's probably the way I would approach it...I'm sure that's not the only way....

Edited by - rdouglass on 02/05/2002 12:33:10




xterradane -> RE: Form error (2/5/2002 17:45:50)

It goes back via Response.Redirect "Registration.asp?Action=InvalidEntry"

If this is not the best way to approach then please let me know. I am trying to stay away from Javascript b/c a lot of my target audience could potentially have it turned off.

Gail

 




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625