Form Validation

B

Boxter

I have a form which I validate client side using javascript. When submitted
with the POST method it calls an asp file which updates the database and
sends a confirmation e-mail.

However before any updates or mails are sent I want to do server side
validation. In the event of an input error, I want to Return the user to the
Same input form with a message in the form pointing out the offending input.

How can I do this. At the moment the form clears once the asp page is called.
 
M

MikeR

In the receiving asp page, write your validation script, then if you detect errors, set
some session variables (would hidden fields in the form be available?), and show a form
like this
<form>
Errors have been detected. Go back and correct them.
<input type="button" value="Return to Whatever" name="B3" onclick="history.back()">
</form>
In any case, however you could incorporate the onclick="history.back()" should work,
taking you back without clearing the input form. Then you can process the session
variables to highlight the errors. If you click the back button on the browser, it should
also take you back without clearing the input form.

Not the most elegant, but it might work.
MikeR
 
B

Boxter

Hi MikeR,

I used the history function from my asp page this way:
response.write("<a href='javascript: history.go(-1)'>e-mail not vaid</a>")
And that works fine for my case; I get the form back and the inputs intact.

Thanks for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top