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
Amita TatarAmita Tatar 

oncomplete alert not showing any value

<apex:page>
 <apex:form >
   <apex:pageBlock title="Order Create/Edit">
      
       <apex:actionRegion >

          <apex:pageBlockSection title="Account Information">
         <apex:inputField value="{!order.AccountId}" id="exname">
            <apex:actionSupport event="onchange" action="{!AccountPopulated}"   oncomplete="grabExName();" rerender="accinfo, msgs"/> 
         </apex:inputField>
   
         <apex:outputField id="messageText" value="{!order.Account.Message__c}"/>
     <!--<apex:variable var="new" value="{!order.Account.Message__c}"/> -->
       
        </apex:pageBlockSection>


</apex:form>
<apex:page>
Hi,
I have pasted my code here. The problem i am facing is that the alert is not showing any value when the oncomplete event occurs.Pl help
 
Abhijeet Anand 6Abhijeet Anand 6
Where is the function body? You have called the method grabExName() but it's body is missing.
Amita TatarAmita Tatar
<script type="text/javascript">
function grabExName()
{
 alert('{!$Component.messageText}');
}
</script
I have added this
 
Abhijeet Anand 6Abhijeet Anand 6
This should work:

<apex:page id='pgId'>
 <apex:form id='frmId'>
   <apex:pageBlock title="Order Create/Edit" id = 'pbId'>
      
       <apex:actionRegion >

          <apex:pageBlockSection title="Account Information" id= 'pbsId'>
         <apex:inputField value="{!order.AccountId}" id="exname">
            <apex:actionSupport event="onchange" action="{!AccountPopulated}"   oncomplete="grabExName();" rerender="accinfo, msgs"/> 
         </apex:inputField>
   
         <apex:outputField id="messageText" value="{!order.Account.Message__c}"/>
     <!--<apex:variable var="new" value="{!order.Account.Message__c}"/> -->
       
        </apex:pageBlockSection>


</apex:form>


    <script type="text/javascript">
        function grabExName()
        {
         //alert('{!$Component.messageText}');
         var text = document.getElementById('pgId:frmId:pbId:pbsId:messageText').value;
         alert(text);
        }
    </script
<apex:page>