You need to sign in to do that
Don't have an account?

How to get the value after button click.
Hi
i have one command button "save" which return the apex message after the operation. i need to check for the particular message return.i.e
suppose below is my save button
<apex:pageMessages id="pmsg"/>
<apex:commandButton value="Save" action="{!Save}" />
which return the apex message. i need that if the message is" not enough value exist"
thn i need the confirmation box
"are u sure want to create act thn click the ok "
if it click ok thn it redirect the action save again with the parameters as i did
<apex:actionFunction name="CallApexMethod" action="{!Save}">
<apex:param name="key" value="val"/>
</apex:actionFunction>
My Logic:
<apex:form id="form" >
<apex:pageBlock title="FF Info" id="pb">
<apex:pageMessages id="pmsg"/>
<apex:commandButton value="Save" onclick="CallApexMethod1();" oncomplete="Redirect();" />
<apex:actionFunction name="CallApexMethod1" action="{!Save}"/>
<apex:actionFunction name="CallApexMethod" action="{!Save}">
<apex:param name="key" value="val"/>
</apex:actionFunction>
<script>
function Test()
{
alert("1");
CallApexMethod1();
}
function Redirect()
{
alert("2");
var msgval= document.getElementById("{!$Component.form.pb.pmsg}").innerText;
alert(msgval);
if(msgval =='Not enough miles in account')
{
if (confirm('There are not enough miles in that account. Are you sure you want to continue?'))
{
alert("3");
CallApexMethod() ;
}
}
alert("4");
}
</script>
</apex:form>
</apex:page>
But it not work. also the message is not compare.
In Nutshell :I have one button save on click it and it hit the http and i gt msg which i print in apex message. suppose i gt mesage "not enough" thn i not save the data. but now i need that if this msg comes a confrimation box will display if it click ok it saves othervwse not
please guid me if you get anything.
thanks
Hi,
create condition in class & chk at http response and pass Message Apexpages.addMessage(new Apexpages.Message(Apexpages.severity.INFO,'your message')); create chk for confiration if for "not enough" before save data..
Thanks