1
<apex:page standardController="Account">
  <apex:form >
  <script>
  function showSimpleDialog(){    
   var sd = new SimpleDialog("Test"+Dialogs.getNextId(), false);    
   sd.setTitle("Test Pop up");   
   sd.createDialog();   
   window.parent.sd = sd;   
   sd.setContentInnerHTML("<p align='center'><img src='/img/msg_icons/warning32.png' style='margin:0 5px;'/></p><p align='center'>This is awesome!</p><p align='center'><br /><button class='btn' onclick='window.parent.sd.hide(); return false;'>cancel</button></p>");    
   sd.show();   
 }  
 </script> 
  <apex:pageBlock >
  <apex:pageBlockSection columns="1">
  <apex:inputField value="{!Account.Name}"/>
  <apex:inputField value="{!Account.BillingCity}"/>
  <apex:inputField value="{!Account.BillingPostalCode}"/>
  <apex:inputField value="{!Account.Phone}"/>
  <apex:commandButton value="save" onfocus="showSimpleDialog();"/>
  </apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
</apex:page>

i dnt want to use controller,please suggest me what to do?!i have to use jquery.if i place my cursor in phone field,then popup should be shown.thanks advance

2
  • Where is the save button present? Is it custom VF page?
    – Saroj Bera
    Oct 27 '16 at 7:01
  • yes ,,itis vf page,but i wanted to show popup when i click on phone field.
    – Satya
    Oct 27 '16 at 7:07
2

To get it displayed on phone field, use onfocus() event of phone field.

<apex:page standardController="Account">
    <script type="text/javascript">
        var __sfdcSessionId = '{!GETSESSIONID()}';
    </script>
    <script src="../../soap/ajax/38.0/connection.js" type="text/javascript"></script>    
  <apex:form >
  <script>
        function showSimpleDialog(){    
            var sd = new SimpleDialog("Test"+Dialogs.getNextId(), false);
            sd.setTitle("Test Pop up");   
            sd.createDialog(); 
            sd.setWidth(350);
            window.parent.sd = sd;   
            sd.setContentInnerHTML("<p align='center'><img src='/img/msg_icons/warning32.png' style='margin:0 5px;'/></p><p align='center'>This is awesome!</p><p align='center'><br /><button class='btn' onclick='window.parent.sd.hide(); return false;'>cancel</button></p>");    
            sd.show();   
        }
 </script> 
  <apex:pageBlock >
  <apex:pageBlockSection columns="1">
  <apex:inputField value="{!Account.Name}"/>
  <apex:inputField value="{!Account.BillingCity}"/>
  <apex:inputField value="{!Account.BillingPostalCode}"/>
  <apex:inputField value="{!Account.Phone}" onfocus="showSimpleDialog();"/>
  <apex:commandButton value="save"/>
  </apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
</apex:page>

enter image description here

1
  • If the fix worked, please mark it as answer so others can benefi.
    – Saroj Bera
    Oct 28 '16 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.