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

I am trying to display an alert by checking a boolean value returned from a method in VFP. But I am getting an error.
<apex:page controller="PopUp" showHeader="false" standardStylesheets="false" sidebar="false">
<script>
function myJavascriptFunc()
{
CallApexMethod();
}
</script>
<apex:form >
<apex:actionFunction name="CallApexMethod" action="{!IF(check,alert('PopUp'),'')"/>
<apex:pageBlock >
<apex:pageBlockButtons>
<apex:commandButton value="Hit Me" action="{!myActionInController}" onclick="myJavascriptFunc();"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
<script>
function myJavascriptFunc()
{
CallApexMethod();
}
</script>
<apex:form >
<apex:actionFunction name="CallApexMethod" action="{!IF(check,alert('PopUp'),'')"/>
<apex:pageBlock >
<apex:pageBlockButtons>
<apex:commandButton value="Hit Me" action="{!myActionInController}" onclick="myJavascriptFunc();"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Greetings!
Can you please try by checking the value in the controller itself and display alert based on the value as mentioned in the below thread:
https://salesforce.stackexchange.com/questions/20668/access-controller-variable-in-javascript
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
All Answers
Greetings!
Can you please try by checking the value in the controller itself and display alert based on the value as mentioned in the below thread:
https://salesforce.stackexchange.com/questions/20668/access-controller-variable-in-javascript
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri