how to add/remove option for reference field based on a field selection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2019 03:18 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2019 03:44 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2019 03:46 AM
Hi,
For reference field, you cannot use add or remove options. it works for select fields.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2019 03:45 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2019 03:49 AM
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.