• Michael Casiano
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi,

I am a Trainee in VF development. Stucked in between one assignement. Please suggest me solution to fulfill below requirement. 

Requriment: User should be able to select an Account, based on the selected Account, show Account’s Name, Industry and Type in new section.
 
<apex:page controller="AccountDetails">

<script type="text/javascript">
    function getRemoteAccount(){
        alert(document.getElementById("form1.accName"));//Unable to access selected value
    }

</script>
 <apex:form id="form1">
 <apex:pageblock >
     <apex:pageblockSection >
         <apex:inputField value="{!acc.AccountId}" id="accName" onchange="getRemoteAccount()"/>
     </apex:pageblockSection>
     <apex:pageBlockSection >
     <span id="span1" />
     </apex:pageBlockSection>
 </apex:pageblock>
 </apex:form>
</apex:page>
 
/************Controller*********************/

public class AccountDetails {

    public contact acc { get; set; }
}