• Sonali Mhatre 1
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I want to call a method from controller extension on the onfocus event from Visualforce Code.My Controller Extension method has a System.debug statement. The following debug method call is not displayed in the Developer Console.

Visualforce Code where call to Controller Extension's method is made:
        <apex:inputField value="{!SomeLookupField}"  onchange="getMethod()"/>

Controller Extension Code:
             public PageReference getMethod() 
               {
                       System.debug('inside method getMethod()');
                }
 
I tried to refer to several posts on the developer forum but it does not seem to work still.
Can you please suggest on this?







 
I have created a custom object called "Session" on which I have section "Dispatch Form" on which I have created 5 fields and one custom button . When the button is clicked visualforce popup window opens on which I have 3 fields "Escalation Description(Text), Escalation Reason(Picklist), Escalation Status(Picklist) and Save button" . I have written javascript code on visualforce page which should prevent saving of data  if any field on the popup is empty else it should save the data. But even though all the fields are populated the save action does not go through.
 
<apex:page standardcontroller="Session__c" >
 <apex:form id="createEscalation" >   
   
                   
                               
      <apex:pageblock mode="edit" title="Edit Escalation" id="thepageblock">
              
               <apex:pageBlockButtons >
                                
                     <apex:commandButton action="{!QuickSave}" value="Save" oncomplete="window.top.close();" onclick="return confirmation();" />

           </apex:pageBlockButtons>

                 
           <apex:pageBlockSection columns="2" id="thesection">
 
                   <apex:inputfield value="{!Session__c.Escalation_Description__c}" required="false" id="ed"/><br/>
                  
                   <apex:inputfield value="{!Session__c.Escalation_Reason__c}" id="er"/><br/>
                
                   <apex:inputfield value="{!Session__c.Escalation_Status__c}" id="es"/>

           </apex:pageBlockSection>                                           

       </apex:pageblock>
       
 </apex:form>
 
 <script type="text/javascript">
    function confirmation()
    {
        var x = document.getElementById('{!$Component.createEscalation.thepageblock.thesection.ed}').value;
        var y = document.getElementById('{!$Component.createEscalation.thepageblock.thesection.er}').value; 
        var z = document.getElementById('{!$Component.createEscalation.thepageblock.thesection.es}').value;
        
       alert("Value of x :"+ x);
       alert("Value of y :"+ y);
       alert("Value of z :"+ z);
           if(x=="" || y=="" || z=="")
           {
                alert("Please enter the values for all fields.");
                return false;
           }
           else {
           alert("Save and close.");
           return true;
           }
 
      }
            
           
</script>

</apex:page>

 
I want to call a method from controller extension on the onfocus event from Visualforce Code.My Controller Extension method has a System.debug statement. The following debug method call is not displayed in the Developer Console.

Visualforce Code where call to Controller Extension's method is made:
        <apex:inputField value="{!SomeLookupField}"  onchange="getMethod()"/>

Controller Extension Code:
             public PageReference getMethod() 
               {
                       System.debug('inside method getMethod()');
                }
 
I tried to refer to several posts on the developer forum but it does not seem to work still.
Can you please suggest on this?







 
I want to call a method from controller extension on the onfocus event from Visualforce Code.My Controller Extension method has a System.debug statement. The following debug method call is not displayed in the Developer Console.

Visualforce Code where call to Controller Extension's method is made:
        <apex:inputField value="{!SomeLookupField}"  onchange="getMethod()"/>

Controller Extension Code:
             public PageReference getMethod() 
               {
                       System.debug('inside method getMethod()');
                }
 
I tried to refer to several posts on the developer forum but it does not seem to work still.
Can you please suggest on this?