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
Aswin B SAswin B S 

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>
 
Best Answer chosen by Aswin B S
ShirishaShirisha (Salesforce Developers) 
Hi Aswin,

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

ShirishaShirisha (Salesforce Developers) 
Hi Aswin,

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
This was selected as the best answer
AnudeepAnudeep (Salesforce Developers) 
Hi Aswin - Can you please specify the error?