Thursday, 11 July 2013

How to get field value from visual force page to Java script function

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>

3 comments:

  1. Great.. Tutorial is just awesome..It is really helpful for a newbie like me...

    JavaScript Online Training JavaScript Online Training JQuery Online Training JQuery Online Training
    JavaScript Course | HTML5 Online Training

    ReplyDelete
  2. AngularJS Training in Chennai AngularJS Training in Chennai Node.js Training in CHennai Angular 2 Training in Chennai Angular 2 Training in Chennai Node.js Training in CHennai Node.js Training in chennai Full Stack Developer Training in Chennai Full Stack Developer Training in Chennai JavaScript Training in CHennai

    ReplyDelete