I have 3 javascript functions:
validateClk(), validateAmPm() and getClks()
And on two occurring events, they get executed as follows:
OnChange - executes validateClk() and validateAmPm()
OnClick - executes getClks() (getClks() returns a boolean value)
All 3 functions run correctly, but the problem is, after getClks() has finished execution and returns a boolean, the next function postClocks() doesn't run. I'm very sure that the code for postClocks() is correct as well. If I don't use the return statement for getClks() then the getClks() function doesn't work as expected.
Please help :(
<script type='text/javascript'>
function validateClk() {
....
var clks = clocks.value;
if (clks == "") {
alert('Enter time');
}
else { ... }
}
</script>
<script type='...'>
function validateAMPM() {
...
var ampm= ap.value;
if (ampm=="") {
alert('Enter am or pm');
}
}
</script>
<script type='text/...'>
function getClks() {
var clks= clock.value;
var ampm= ap.value;
if (clks==" && ampm="") {
alert('Enter time and am/pm');
return false;
}
else { ... }
return true;
}
</script>
<... onChange="validateClk(); validateAmPm();" />
<... button label="Submit" onClick="return getClks(); postClocks(); return false;" />