Click to See Complete Forum and Search --> : cancel submit event


October 26th, 1999, 03:42 AM
how to cancel submit event after an submit button has been pressed in a html page?

Lothar Haensler
October 26th, 1999, 04:20 AM
return FALSE in the onsubmit event handler for your form object.

October 26th, 1999, 05:00 AM
do u have any sample code for my reference?

Lothar Haensler
October 26th, 1999, 06:09 AM
<FORM onsubmit="return(FormOk());">
...
function FormOk()
{
if( everythingIsOk ) {
return(false);
}
else{return(true);}
}
(Jscript code)

October 26th, 1999, 08:31 PM
hai lothar..

i tried it out but doesn't work.... i attach the code below... i'm using VB script...


function submitSuccess()
if error then
submitSuccess = false
else
submitSuccess = true
end if
end function

<form onsubmit="submitSuccess()">

is there anything wrong with my code???




thanks in advance....

Lothar Haensler
October 27th, 1999, 10:18 AM
yes, there is something wrong with your code.
you need to write
<form onsubmit="return(...)"...