Display all fields based on List collector option selection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2023 12:45 AM
Hi All,
I want to display multiple select box / checkboxes based on the List collector variable(application).
for eg : Bullhorn and Basware Alustra selected then its associated fields should come up. As of now, it overrides/hides previous fields if a new value is selected in the list collector(Application)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2023 01:47 PM
Hi, looking at your script you are looping through the records in your array and this would mean that the last element checked would dictate what was\was not visible.
IE if 'Basware Alusta' was at index[0] and the array had more than 1 element, then after index[0] the result for 'Basware Alusta' would always be
g_form.setDisplay('basware_alusta', false);
Rather than using a loop to evaluate your array content I would leave the array content as a string and use indexOf() to evaluate if the required value exists anywhere in the array.
This way you will get a true or false result regardless of the number of elements in the array or their position within the array. Partial example based on your code.
var str = newValue.toString();
//Common - Basware Alusta
if(str.indexOf('c1ebebdc1b6a659820f1dce2b24bcb7e') != -1) {
g_form.setDisplay('basware_alusta', true);
} else {
g_form.setDisplay('basware_alusta', false);
}
//Common - Bullhorn
if(str.indexOf('2edbe3181b6a659820f1dce2b24bcb4f') != -1) {
g_form.setDisplay('bullhorn', true);
g_form.setDisplay('manpower_finland_enterprise_standard_user_default', true);
g_form.setDisplay('manpower_finland_enterprise_standard_user_canvas', true);
g_form.setDisplay('manpower_finland_executive_search_free_usertype_separated_account', true);
g_form.setDisplay('manpower_finland_enterprise_admin_user', true);
} else {
g_form.setDisplay('bullhorn', false);
g_form.setDisplay('manpower_finland_enterprise_standard_user_default', false);
g_form.setDisplay('manpower_finland_enterprise_standard_user_canvas', false);
g_form.setDisplay('manpower_finland_executive_search_free_usertype_separated_account', false);
g_form.setDisplay('manpower_finland_enterprise_admin_user', false);
}
//add addtitional checks as requred.