Onchange client script for when a field changes

GB14
Kilo Patron

Hello,

We have a requirement where a filed needs to change based on another field. 

If "Cost center" change then "EOC" should display the "list of codes" based on selected "Cost center"

I'm a novice at scripting. Any help would be greatly appreciated.

Thank you 🙂

1 ACCEPTED SOLUTION

GB14
Kilo Patron

Thanks everyone. We ended up getting help from the vendor and they were able to do the needful. 🙂

View solution in original post

12 REPLIES 12

Mike Patel
Tera Sage

Does EOC has any reference to cost center? if so you can add filter on EOC field something like cost_center=current.cost_center; 

This is just an example so make sure fields exists.

Kunal Varkhede
Tera Guru

Hi,

 

You can Write Onchange client script on Cost Center field.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}

if(newValue != oldValue)

{

//modify below as per your field name

g_form.setValue('EOC','','list of codes');//setValue(String fieldName, String value, String displayValue)}


}


 

Please Mark Correct/Helpful answer if it help you in any way.

Thanks,

Kunal.

 

These are our requirements actually. 

find_real_file.png