I have a plain(no fancy frameworks) javascript, which, on the submission of a form element, asks the user a question. If the answer returns true, then the script sets the form's action to a certain URL (which has some server-side logic inside it) and calls the sumbit method of that form. Or at least, in theory, thats what its meant to do! But it doesnt.. it just doesn't do anything. It seems to submit the form, but if it did, the server-side logic in the other file (which has been set as the action property's value) would ensure the user is taken somewhere else.
Here is my form:
<form name='myForm' id='myForm' method='post' onSubmit='annoyTheUser(this);'>
Here is my javascript function:
function annoyTheUser(theForm)
{
if(confirm("blah?"))
{
theForm.action = 'savequestion.asp';
theForm.submit();
}
}