Anurag Tripathi
Mega Patron

Problem: Show/Hide Form Sections with client scripts is used quite often and is a very simple , unless you have a long section name with multiple spaces. 

 

Solution: This blog will cover how to tackle all scenarios to hide/show form sections with client side code. 

 

No Spaces in the section name:

For Eg, you have a section called 'Planning'.

To Hide: g_form.setSectionDisplay('planning', false);

To Showg_form.setSectionDisplay('planning', true); 

 

One Space in the section name Just replace the space with _

For Eg, you have a section called 'Related Records'.

To Hide: g_form.setSectionDisplay('related_records', false);

To Showg_form.setSectionDisplay('related_records', true); 

 

Multiple Space in the section name: Replace first space with _ and remove all other spaces

For Eg, you have a section called 'Process And Compliance Details'.

To Hide: g_form.setSectionDisplay('process_andcompliancedetails', false);

To Showg_form.setSectionDisplay('process_andcompliancedetails', true); 

 

I have spend a few hours in the past struggling with this, and recently saw some else struggle as well so decided to write about this.

Hope it helps.