"Randell D." <re**********************@and.share.com> wrote in
news:g%Wwb.497470$pl3.300911@pd7tw3no:
I have the following code for my submit button
<input type="submit" name="action" value="Save Article"
onClick="this.value='Saving...'; performPrePostChecks();">
[snip]
How come that irrespective of the function performPrePostChecks
returning true, or false, that the form is still submitted?
Because that's what you asked it to do. To be more specific, an action
handler is treated as if it's a function, with the return value determining
whether or not to go ahead. You don't return anything, so the default is
"yes, go ahead." Try returning the result of your checking function.
Is it possible that you're used to Perl, where a function (aka sub) by
default returns the value of the last statement executed? Javascript
doesn't use that convention; if you want to return a value, you have to do
so explicitly.