+ Start a Discussion

Prepolulate salesforce page fields



I have the following setup. Two fields fildA and feildB on a salesforce custom object page.


I need to be able to do the following:


If user selects or enters any value in feildA then fieldB should get the same value momentarly.


I think some javascipt/ajax majic, but I don't have a design or plan so far.


Can anyone help?


Thank you.

Ben EllingtonBen Ellington

You'll need to use Visualforce to make that happen.


Can you provide a starter code?

Raumil SetalwadRaumil Setalwad

In visual force page the two fields field A and field B are located in page block section where id of A = aid and ID of B = bid

Now in javascript:-



function assignValue(){
	document.getElementById('bid').value = document.getElementById('aid').value
	document.getElemenById('pageId:formId:pagblockId:bid').value = document.getElemenById('pageId:formId:pagblockId:aid').value

 Hope this helps