I have a html form that I process with a aspx page. I want to be able to go back to my html form if the validation on the aspx page returns false (I cannot use javascript to validate the html form). I can’t use Response.Redirect as I will lose the data initially entered on the html form.
The set-up is:
- form.html (set action attribute of form tag to processform.aspx)
- processform.aspx (get values from html form using Request.Form[“myvalue”])
if values are invalid, go back to form.html, otherwise Response.Redirect(“success.html”)
Perhaps I am just going about this the wrong way. Could anyone suggest a better method?
Please note: I cannot use javascript on the form.html, however I can use javascript on the processform.aspx page – although I would prefer an alternative if possible.
You say that form.html can’t use any javascript on form.html – does that mean you can’t use Javascript at all in this solution?
My answer would be to output a javascript snippet from your processform.aspx that simply calls
history.go(-1).Example:
If, however, you cannot use Javascript at all… the options are rather limited.
RFC 2616 defines HTTP 204 “No Content” – you could attempt to send that, but this is a success status, and behaviour from browsers might vary. Theoretically, however, the content should stay the same. Users might be very confused, however, because there’s no visible feedback.
If you could explain the reasoning behind these restrictions, perhaps we could produce a better solution.