Hide Form Sections

Lohith
Giga Expert

Hi Team,

I want to hide form sections based on the condition.  we have created 2 form sections, both the form sections has certain fields, and fields with mandatory too. Now, when i try to hide the form section using g_form.setSectionDisplay('<form section name>', false), it is not hiding the form section.

If all the mandatory fields are filled in that section and tried to hide than it is successful, but why its not hiding when it has mandatory fields. I have made fields mandatory via UI Policy.

Appreciate your inputs.

Thanks,

Lohith

1 ACCEPTED SOLUTION

vinothkumar
Tera Guru

Yes, this is the expected behaviour. g_form.setSectionDisplay('<form section name>', false), will check whether is there any fields are mandatory, before hiding it.

 

Before hiding the section in the client script, you have to make the fields in the section as g_form.setMandatory('field_name', false); for all the fields in the section and then you have to add g_form.setSectionDisplay('section name', false); it will work

View solution in original post

8 REPLIES 8

Lohith
Giga Expert
Hi, Thanks for your reply. Based on certain conditions I will display the form section, but later I try to change condition because I have selected wrong conditions, so now I have to hide the form section and display other form section. So now it’s not hiding instead it’s displaying on form which is not correct.

vinothkumar
Tera Guru

Can u paste the copy of your script here.

 

Lohith
Giga Expert

I used UI Policy to hide and show Form section based on the condition, wrote script to show form section when condition satisfies and when condition fails to hide the form section. It is working fine as expected even if mandatory fields are present in form section its hiding the form section.

g_form.setSectionDisplay('section name', true); to show form section

g_form.setSectionDisplay('section name', false); it hide form section

Tushar Walveka2
Tera Guru
g_form.setSectionDisplay('schedule', false);

The first parameter is simply the name of your section, which should be completely lower-case.

Sections including spaces should use an underscore in place of the first space with the rest of the spaces removed.

For example, a form section with a label of ‘Schedule and Planning’ would require a parameter of ‘schedule_andplanning’. The second parameter is a true/false boolean that indicates whether the form section should be visible or not.