- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 11:53 AM
Hello team,
I have a requirement where I need to populate a field based on the keywords typed in another field.
Eg:
The form has a field titled "Name of security group"
If the user types in anything that begins with or contains "KRA.", it will show another field to the user titled "Please select the group to be added into the new group".
Is this possible using onChange scripting?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 12:44 PM
For example, in the client script "OnChange"
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue.includes('KRA.')) {
g_form.setVisible('Your display field', true);
} else {
g_form.setVisible('Your display field', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 12:58 PM
Hi @Rohan ,
Yes onChange client script should will work but please ensure that when you hide the field 'Please select the group to be added into the new group' if the 'KRA' is removed then make 'Please select the group to be added into the new group' field non-mandatory before (in case, it is set to mandatory when visible).
If this address your question, please mark this response correct by clicking on Accept as Solution and/or Kudos.
You may mark this helpful as well if it helps you.
Thanks,
Animesh Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 12:44 PM
For example, in the client script "OnChange"
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue.includes('KRA.')) {
g_form.setVisible('Your display field', true);
} else {
g_form.setVisible('Your display field', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2024 12:58 PM
Hi @Rohan ,
Yes onChange client script should will work but please ensure that when you hide the field 'Please select the group to be added into the new group' if the 'KRA' is removed then make 'Please select the group to be added into the new group' field non-mandatory before (in case, it is set to mandatory when visible).
If this address your question, please mark this response correct by clicking on Accept as Solution and/or Kudos.
You may mark this helpful as well if it helps you.
Thanks,
Animesh Das