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
Sfdc Project 17Sfdc Project 17 

display message inside a single popup based on condition

Hi all,

I want help in acheiving this.
OnClick of submit button , check if condition is true, then display "Hello World" inside popup    and if condition is false then display "please enter a review first" inside popup.

Please help someone
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi, hope it will be helpful.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar
Suraj TripathiSuraj Tripathi
Hi sfdc,

Try this piece of code.
 
<apex:page >
 <apex:form id="formid">
 <apex:pageblock id="formid1">
 
 <apex:panelGrid columns="2">
 <apex:inputText id="theTextInput"/>

 <apex:commandButton value="Update" style="width:90px" onclick='popup()'/>
 </apex:panelGrid>
 </apex:pageblock>
 </apex:form>
 
 <script type="text/javascript">
 
 function popup(){
 var a=document.getElementById('{!$Component.formid.formid1.theTextInput}').value;
 
 if(a == '' || a == null)
 {
 alert('please enter a review first');
 }
 else{
 
 alert('Hello world');
 }
 
 }
 </script>
 
</apex:page>
Kindly mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Regards
Suraj

 
Sfdc Project 17Sfdc Project 17

Thanks for the response rahul and suraj
but i dont want to display a alert message

--> I want 'popup' box to be open

OnClick of submit button , i want to display messages inside popup box according to condition. it shuld check:
--> if condition is true, then display "Hello World" inside popup box   
--> if condition is false then display "please enter a review" inside popup box
 

If anyone can help me with an example, that will be very helpful.
Thanks in advance