How to get field value from visual force page to Java script function
<apex:page sidebar="false">
<script>
function method1(data)
{
//var dataVal= data.value;
var d=document.getElementById(data).value;
alert('********The field value is ********'+d);
}
</script>
<apex:pageBlock id="pgblock1" >
<apex:form id="form1">
<apex:outputText >First Name</apex:outputText><br/>
<apex:inputText onchange="method1('{!$Component.pgblock1.form1.fname}');" id="fname" />
<br/><hr/>
<apex:outputText >Last Name</apex:outputText><br/>
<apex:inputText /><br/>
</apex:form>
</apex:pageBlock>
</apex:page>
<apex:page sidebar="false">
<script>
function method1(data)
{
//var dataVal= data.value;
var d=document.getElementById(data).value;
alert('********The field value is ********'+d);
}
</script>
<apex:pageBlock id="pgblock1" >
<apex:form id="form1">
<apex:outputText >First Name</apex:outputText><br/>
<apex:inputText onchange="method1('{!$Component.pgblock1.form1.fname}');" id="fname" />
<br/><hr/>
<apex:outputText >Last Name</apex:outputText><br/>
<apex:inputText /><br/>
</apex:form>
</apex:pageBlock>
</apex:page>
No comments:
Post a Comment