client script

shivaadapa
Tera Expert

Hi

if i select one value from reference field then the two fields in the refrence field table values should be populate in the present table two fields. How can i achieve this?

 

11 REPLIES 11

Mark Manders
Mega Patron

Is this for a catalog item on the portal, or in the backend?
In both cases you will need a client script to get the values from the reference table to fill on the form, but the setup is a bit different.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hi @Mark Manders 

In the backend form i am trying.

shyamkumar VK
Kilo Patron

@shivaadapa , we can do this via client script 

using get reference with callback function , I have added sample script for you

function onChange(control, oldValue, newValue, isLoading) {
   var userObject = g_form.getReference('requested_by', doAlert); // doAlert is our callback function
}
function doAlert(userObject) { //reference is passed into callback as first arguments
   g_form.setValue('department', userObject.department);
}
 
 
Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

Hi @shyamkumar VK 

I am trying in the backend form. can we use other than getreference?