Reputation: 287
i have a jsp page in which there are three functions on onclick
event.
i want that on onclick
of submitformFinal()
function , it should check whether its true
or false
and then depending on outcome, it should execute the other two functions.
my onlick
functions are:-
onclick="javascript:changeAction('save');checkMultiSelects();submitformFinal();" />
Upvotes: 0
Views: 296
Reputation: 6639
I would suggest wrapping the other two functions onto your initial function and call them from there.
For example:
function changeAction('string') {
// do some stuff
// return true or false
if (action==true) {
checkMultiSelects();
submitformFinal();
} else {
return false;
}
}
Upvotes: 0
Reputation:
you can try like this
function changeAction(action)//value pass to the variable action
{
if()//your condition is true
{
return checkMultiSelects();
}
return false;
}
function checkMultiSelects()
{
if()//true
{
return submitformFinal();
}
return false;
}
function submitformFinal()
{
if()//true
{
return true;
}
return false;
}
and use this code on jsp page
onclick="javascript:return changeAction('save');" />
Upvotes: 1
Reputation: 8530
It is very simple.
if(actionReturn==true){
callMethod1();
callmethod2();
}else{
return false;
}
Upvotes: 0