Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancelling a form POST action

Status
Not open for further replies.

trimtrom

Programmer
Dec 12, 2003
35
0
0
GB
Hello

I am a web beginner, and I have a login page as the first page of a ASP web application I am designing. On this page I have a standard HTML form of two input boxes for username and password and a submit button to POST the input to another form.

My problem is that I want to validate this information before the POST, and if necessary cancel the POST so that I stay on the current page in order to correct the form input and try again. I have succeeding in validating the input using VBscript routines so that I know when I want to cancel, but I don't know the cancel command.

The VBscript routine where I do the validation is the submit button_click event and I presume that is where the cancel command would go. Is this correct? I would be very grateful for code clips on how to issue the cancel command.

Many thanks,

Trimtrom
 
Unless you want your page to only work in IE, I suggest you switch to JavaScript, rather than using VBScript. Here's roughly how you should do this:

Code:
<script type="text/javascript">
	function validated() {
		// this function should return the boolean value true
		// if validation is successful, false otherwise
	}
</script>

...

<form onsubmit="return(validated());">

If you need to take it further, I suggest heading over to the JavaScript forum (forum216).

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Many thanks for the help. However I am writing this for an intranet which only uses IE, and I have been told to use VBscript.

Is there any way you could provide a solution in VBscript?

Many thanks,

Trimtrom
 
Try making an example yourself. If you have any specific problems, ask them in the VBScript forum.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top