rcky
rcky

Reputation: 287

Calling jsp functions

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

Answers (3)

francisco.preller
francisco.preller

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

user918477
user918477

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

Balaswamy Vaddeman
Balaswamy Vaddeman

Reputation: 8530

It is very simple.

if(actionReturn==true){
     callMethod1();
     callmethod2();
    }else{
    return false; 
    }

Upvotes: 0

Related Questions