You need to sign in to do that
Don't have an account?
subrat_ray
auto-populate field values in a object
Hi All,
I have two fields of currency type.
Requirement is, when I enter any value in the first field, then it should automatically be
populated in the second as the default value.
If I change the value in the second field, it should hold the latest
value otherwise the default value (same as first).
Thanks,
Subrat
Use Javascript on VF page:
Thanks Shiva,
I am not getting this works.
Below is code. Please have look. Checked with onblur() also.
<apex:page standardController="contact">
<script type="text/javascript">
function copyfirstfield()
{
document.getElementById("{!$Component.test.blk.secondfielditem.secondfieldID}").value = document.getElementById("{!$Component.test.blk.firstfielditem.firstfieldID}").value;
}
</script>
<apex:form id="test">
<apex:pageBlock id="blk">
<apex:pageBlockSection >
<apex:pageBlockSectionItem id="firstfielditem">
<apex:outputLabel value="field1" />
<apex:inputField value="{!Contact.first__c}" id="firstfieldID" onChange="copyfirstfield();" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="secondfielditem">
<apex:outputlabel value="field2" />
<apex:inputField value="{!Contact.second__c}" id="secondfieldID" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Thanks,
Subrat
for onChange try this --->onkeyup="Copyfirstfield();"
give pageblock section id. that's missing