- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 11:58 AM - edited 09-05-2024 12:09 PM
Hi,
I have a requirement to populates(add) value in a list collector's value/ remove the value of the list collector field, based on 3 check box fields.
I have tried Script include and onChange client script and also tried to modify through Reference qualifier of the list collector field. But nothing is working.
Please suggest me a better way to achieve it.
Reference picture of my requirement:
- If the user choose Digital Engg app in the Application field, the check boxes will appear.
- Then if user checks any check box, it will add/remove the value in Application field.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 03:46 PM
Good job with the logs. You were very close - just a misplaced } that was causing there to be no 'else' to the if (newValue == 'true'). Then you would have discovered that you want to use splice to remove an element from an array in this case, not slice which creates a new array with the removed elements. Here's the working if block:
if (newValue == 'true') {
if (appVal.indexOf(jira_sysid) === -1) {
appVal.push(jira_sysid);
alert('added: ' + jira_sysid);
}
} else {
var index = appVal.indexOf(jira_sysid);
alert('index found at: ' + index);
if (index != -1) {
alert('removing');
appVal.splice(index, 1);
} else {
alert('value not found for removal!');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2024 03:40 AM
Great to hear. You are welcome!