- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2024 06:52 AM
I have a requirement whenever i click the checkbox the list collector value should be populate automatically.
for example, if am choosing development checkbox, "Dataware house" list collector value should automatically.
populate .
i tried code like
if (g_form.getValue('staging') == 'true') {
var arr = [];
var elements = ['IdcDevelopement', 'Idcstaging'];
if (elements.includes(g_form.getValue('datawarhouse_data_module'))) {
arr.push(g_form.getValue('datawarhouse_data_module'));
}
arr.push('Idcstaging');
g_form.setValue('datawarhouse_data_module', arr.toString());
}
when i select development and staging checkbox list collector value should populate as IdcDevelopement ,and idcstaging that is working but when i removed development checkbox it is not showing anything (clearing all the value) but expected result should be idcstaging .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2024 09:50 PM
Hello @sakila ,
You can create the array and store all of the selected values in one required field. Here you can use onChange Client script. Below is the code:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
function updateListCollector() {
var arr = [];
// Check if 'staging' checkbox is selected
if (g_form.getValue('staging') == 'true') {
arr.push('Idcstaging');
}
// Check if 'development' checkbox is selected
if (g_form.getValue('development') == 'true') {
arr.push('IdcDevelopement');
//You can use as many if conditions as per your requirement.
}
g_form.setValue('datawarhouse_data_module', arr.join(','));
}
updateListCollector();
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2024 09:50 PM
Hello @sakila ,
You can create the array and store all of the selected values in one required field. Here you can use onChange Client script. Below is the code:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
function updateListCollector() {
var arr = [];
// Check if 'staging' checkbox is selected
if (g_form.getValue('staging') == 'true') {
arr.push('Idcstaging');
}
// Check if 'development' checkbox is selected
if (g_form.getValue('development') == 'true') {
arr.push('IdcDevelopement');
//You can use as many if conditions as per your requirement.
}
g_form.setValue('datawarhouse_data_module', arr.join(','));
}
updateListCollector();
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Priyanka