- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 08:27 AM
Hi everyone,
I have a requirement that a form section is only display when I select a specific choice in a choice field otherwise the should be hidden.
I created a on change client script but its not working. The section is displayed and when a select "SLIR" choice the section is hidden?? What could be the problem?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var select=g_form.getValue('u_themeselection');
if(select=='SLIR')
{
g_form.setSectionDisplay('slir', true);
}
else{
g_form.setSectionDisplay('slir', false);
}
}
Thanks for your hep.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 08:08 PM
You can write 2 client scripts:
- OnLoad of form where you can hide the section.
- OnChange of choice field where you can check choice value and show the section.
Or you can also have only the OnChange client script if you always want to hide the section even choice value is SLIR
Just one question, do you also want to hide the section on the load of the form even if the choice is "SLIR" in the backend (database)?
Regards,
Reshma
**Please mark my answer correct or helpful based on the impact**
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 08:08 PM
You can write 2 client scripts:
- OnLoad of form where you can hide the section.
- OnChange of choice field where you can check choice value and show the section.
Or you can also have only the OnChange client script if you always want to hide the section even choice value is SLIR
Just one question, do you also want to hide the section on the load of the form even if the choice is "SLIR" in the backend (database)?
Regards,
Reshma
**Please mark my answer correct or helpful based on the impact**
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 11:44 AM
Thanks for your reply. I guess you didnt understand me right.
The section should be hidden when I load the form, only when I select on the frm the choice "SLIR" in the choice fild than the tab should be visible.
Hopefully its now clear.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 12:07 PM
You can write 2 client scripts:
- OnLoad of form where you can hide the section.
- OnChange of choice field where you can check choice value and show the section.
Just one question, do you also want to hide the section on the load of the form even if the choice is "SLIR" in the backend (database)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 12:11 PM
You can also have only the OnChange client script if you always want to hide the section even choice value is SLIR
Regards,
Reshma
**Please mark my answer correct or helpful based on the impact**

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 08:14 PM
I can suggest you some options -
1. Please create OnLoad client script which always hide your section based on your condition. [To debug please add logs]
2. Please create OnChange UI Policy for your field and please add code in UI Policy script. So that will be very easy for you to track.