You need to sign in to do that
Don't have an account?
Ram Manohar G
Oncomplete action function Condition Visualforce
Hi , plz help on this
I have two action function, onclick of 'Next' it invokes 'insertrecord' actionfunction which run same controller method the onComplet of this i am invoking 'doCallout' method using second action function.
Now i want to stop second action function if there is an catch exception in doInsert() and run only if runaction==true . How to do it.
<apex:actionFunction name="InsertRecord" action="{!doInsert}" Rerender="Status1"
status="Status1" oncomplete="doCalllout()"/>
<apex:actionFunction action="{!doCalllout}" name="doCalllout"
reRender="opanel" status="Status2"/>
Controller:
public void doInsert()
{
try{
runaction=true;
}
catch
{
runaction=false;
-----ApexpageMessage-----;
}
}
}
I have two action function, onclick of 'Next' it invokes 'insertrecord' actionfunction which run same controller method the onComplet of this i am invoking 'doCallout' method using second action function.
Now i want to stop second action function if there is an catch exception in doInsert() and run only if runaction==true . How to do it.
<apex:actionFunction name="InsertRecord" action="{!doInsert}" Rerender="Status1"
status="Status1" oncomplete="doCalllout()"/>
<apex:actionFunction action="{!doCalllout}" name="doCalllout"
reRender="opanel" status="Status2"/>
Controller:
public void doInsert()
{
try{
runaction=true;
}
catch
{
runaction=false;
-----ApexpageMessage-----;
}
}
}
<apex:actionFunction name="InsertRecord" action="{!doInsert}" Rerender="Status1"
status="Status1" oncomplete="callOrNoCallCallout()"/>
<apex:actionFunction action="{!doCalllout}" name="doCalllout"
reRender="opanel" status="Status2"/>
<script>
function callOrNoCallCallout(){
if({!runaction})
doCalllout();
}
</script>
Controller:
public void doInsert()
{
try{
runaction=true;
}
catch
{
runaction=false;
-----ApexpageMessage-----;
}
}
}
The issue is, I am unable to display catch message bcz the second action method is calling and loading new page. How can i invoke second one on some condition ?
first set runaction = false , in the try block, after insertion and before return statement make it true . If there is any exception means in catch block again make it false.