function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to get the value after button click.



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"/>



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"/>



function Test()

function Redirect()

var msgval= document.getElementById("{!$Component.form.pb.pmsg}").innerText;
if(msgval =='Not enough miles in account')
if (confirm('There are not enough miles in that account. Are you sure you want to continue?'))
CallApexMethod() ;







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.




Tejpal KumawatTejpal Kumawat


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..