how to add/remove option for reference field based on a field selection

Jasmine1
Kilo Explorer

I have two fields "application"(with 3 values) and another reference field "code".

So based on selection of application (value), I want to control the reference field code to add/remove the value none from the reference table.

I understand that addoption/removeoption only works on choice list.So is there any other way out for this?

This is urgent.

Thank you.

7 REPLIES 7

Shrutika Surwad
Kilo Guru

you can use onchange client script wherein you can see the value selevted in field A and depending on that you can add/remove options in field B(choice List Variable)

 Use these functions for the same

 g_form.addOption('<Variable Name>','<value>','<display value>');   // To add options to the dropdown

 

g_form.clearOptions('<variable name>');   //To remove all values from the dropdown

 

g_form.removeOption('<Variable Name>', '<value>');   // To Remove 1 option from the dropdown

 

g_form.setValue('<Variable Name>','<value>');   // To select by default any one of the options.

 Hope this helps.

Hi,

For reference field, you cannot use add or remove options. it works for select fields.

asifnoor
Kilo Patron

Hi Jasmine,

You can do this with reference qualifiers.

Configure the code field and under reference specifications, you can select advanced and can add the code.

For example, you want to fetch codes based on the value of application, then you can write like ths

javascript:"code=" + current.application //update these with your exact field names. 

Mark the comment as a correct answer and also helpful once worked.

Hi Asifnoor,

 

This also will not help me as the values(code) for all applications is same.Except that i want to the option none for one of the applications.