Trying to make run function after form is submitted
Posted: Fri Jan 07, 2005 4:34 am
Hi,
Using javascript to validate a form (sent via a mailto action).
my function in brief is structured like this
and I'm calling it like this:
So it checks the form... good good... prompts to use mailto (a windows based feature i assume) and then submits the form.
But I want to be able to change the innerHTML in a DIV on the page to show that the form was submitted successfully once the user has clicked "OK" on the dialog that asks permission to use the mailto function.
Unfortunately... the line
return true
prevent any further output from the function so all I can do is show the output first but it shows as successful submission to the user before they even click ok.
Can I make it wait until the mailto dialog is accepted. If you dont get what I mean about the mailto dialog try using mailto: as the action in a form and you'll see it.
Thanks
Using javascript to validate a form (sent via a mailto action).
my function in brief is structured like this
Code: Select all
//I'm just using PHP tags because I prefer the highlighting
//Validate
function validate() {
if (someEl.someVal != "Correct value") {
alert ('You done it wrong!')
return false //Don't submit
} else {
return true //Submit the form
}
}Code: Select all
<form action="mailto:myemail@somedomain.com" onSubmit="return validate()">But I want to be able to change the innerHTML in a DIV on the page to show that the form was submitted successfully once the user has clicked "OK" on the dialog that asks permission to use the mailto function.
Unfortunately... the line
return true
prevent any further output from the function so all I can do is show the output first but it shows as successful submission to the user before they even click ok.
Can I make it wait until the mailto dialog is accepted. If you dont get what I mean about the mailto dialog try using mailto: as the action in a form and you'll see it.
Thanks