+ Start a Discussion
smitha george 5smitha george 5 

Auto populate the field

Hello Guys,

I have one VF page and 2 input text boses..when we enter a value in 1 text box..same value should populate in 2 box .
Can you tell me how we achieve this and  i ll be thankful if you give the code..

Thanks
Smitha
Best Answer chosen by smitha george 5
Vinod ChoudharyVinod Choudhary
Hi Smitha,

You can achieve this using javascript on VF page.
 
<apex:inputField id="firstBox" value="{!YOUR_VALUE}" onchange=" return check();"/> 

<apex:inputField id="scndBox" value="{!YOUR_VALUE_POPULATE}"/> 

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){

function check() {
        j$('#scndBox').val('this is Will populate in  scndBox');
}

});
</script>

Hope this will help you.

Thanks
Vinod