You need to sign in to do that
Don't have an account?
mallikam
not able to get the field values through $component!!
I am trying to access the inputtext field values in javascript through component but I am having hard time doing this..suppose I want to get the value of the field refered by id=reqname in a javascript function, how can I get it through $Component?
<apex:pageBlock mode="edit" id="thePageBlock"> <apex:pagemessages ></apex:pagemessages> <apex:actionRegion > <apex:pageBlockSection columns="1" id="remail"> <apex:inputText value="{!custObj.Requestor_Name__c}" id="reqname" />
Hey
Just to clarify the above
<apex:pageBlock mode="edit" id="thePageBlock"> <apex:pagemessages ></apex:pagemessages> <apex:actionRegion > <apex:pageBlockSection columns="1" id="remail"> <apex:inputText value="{!custObj.Requestor_Name__c}" id="reqname" /> <script> var InputValue = document.getElementById('{!$Component.reqname}').value; </script>
A bit more about this can be found in this article.
Cheers,
Wes
All Answers
Javascript
var InputValue = document.getElementById('{!$Component.reqname}').value;
Hey
Just to clarify the above
<apex:pageBlock mode="edit" id="thePageBlock"> <apex:pagemessages ></apex:pagemessages> <apex:actionRegion > <apex:pageBlockSection columns="1" id="remail"> <apex:inputText value="{!custObj.Requestor_Name__c}" id="reqname" /> <script> var InputValue = document.getElementById('{!$Component.reqname}').value; </script>
A bit more about this can be found in this article.
Cheers,
Wes