Reputation: 179
<td colspan="2" align="center"><html:submit onclick= "return validateText()"
styleId="reject" > Reject Version </html:submit></td>
I want to write one more onclick
event for this button.
Please suggest some good examples.
Upvotes: 1
Views: 8037
Reputation: 1656
Put all onclick events inside the validateText().
function validateText(){
onclick_1();
onclick_2();
....
onclick_N();
}
Upvotes: 0
Reputation: 13468
You could try to add a function encapsulating both calls:
<script>
function myEventHandler() {
if(validateText()) {
theSecondFunction();
return true;
}
return false;
}
</script>
And call it from your button:
<td colspan="2" align="center"><html:submit onclick= "return myEventHandler()"
styleId="reject" > Reject Version </html:submit></td>
Upvotes: 1
Reputation: 7326
function validateText() {
// Call functionA
// Call functionB
}
functionA() {}
functionB() {}
Upvotes: 0
Reputation: 11273
Just make the validateText() function call another function. The event will fire once, and you can do what you want at that point. You cannot bind two onclick events on the same button, if that is what you are trying to do.
Upvotes: 0