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
Salesforce developmentSalesforce development 

When i am change the textbox 1 automatically that vale populate in textbox2?

hi folks,


I got one scenario. I have taken Two <apex:inputText />. When i am enter into textbox1 that value will be automatically populate in textbox2.



Can you please help me.....


thanks for helping....

Best Answer chosen by Admin (Salesforce Developers) 
Laxman RaoLaxman Rao

try this:


VF Page :

<apex:page controller = "Test">
        function populate()
            document.getElementById('{!$Component.form1.txt2}').value = document.getElementById('{!$Component.form1.txt1}').value;
    <apex:form id="form1">
     <apex:inputText value="{!test}" onchange="populate()" id="txt1" />
     <apex:inputText value="{!test2}"  id="txt2" />

public class Test{
    public string test{set;get;}
    public string test2{set;get;}
    public Test() {
        test = 'hai... change me';