Notifications

862 views

Symptoms


After setting g_form.setSectionDisplay function to 'false' in client script, it does not hide the form section on page load.

g_form.setSectionDisplay('<section_name>', false);

Release


All releases 

Cause


There could be two causes for this:

1) The setSectionDisplay function not working properly is due to how the section name is used within the function.

2) There are mandatory fields within the section that is being hidden.

 

Resolution


For the cause of:

1) The setSectionDisplay function not working properly is due to how the section name is used within the function:

As per the documentation on setSectionDisplay, the section name is lower case with an underscore replacing the first space in the name, and with the remaining spaces being removed.

For example:

"Section Four is Here" becomes "section_fourishere".

Other non-alphanumeric characters, such as ampersand (&), are removed.

**Section names can be found by using the getSectionNames() method.

 

For the cause of:

2) There are mandatory fields within the section that is being hidden.

This is expected behavior that if there are mandatory fields within the section being hidden the section itself will not be hidden. The reason is because users won't be able to see which mandatory fields to fill out if the section that contains them is hidden.

 

 

Additional Information


https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_reference/GlideForm/concept/c_GlideFormAPI.html

https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_reference/GlideForm/concept/c_GlideFormAPI.html#ariaid-title53

Article Information

Last Updated:2019-05-21 11:50:30
Published:2019-01-15