Hide Form Section and Section Fields

ar1
Kilo Sage

Hello All,

 

My Requirment:

Under Form Section almost 15 fields are available and we need to hide them based on the selected category.

And also few fields are mandatory before saving the form and few fields are mandatory after saving the form.

we tried UI policy to make fields mandatory before and after saving the form and it's working perfectly with the conditions.

But we're unable to hide the fields based on the selected category, it's showing all the fields irrespective category.

OR

We want to Hide the section and display the section based the selected category.

Advance thanks.... 

1 ACCEPTED SOLUTION

ar1
Kilo Sage

HI All,

 

Thanks you so much for all your inputs.

Instead of hiding and showing the fields we hide the section And display the section with the required fields based on the category.

Below script we tried in Ui policy to hide the section. 

Condition : Category is X

if true:

function onCondition() {

g_form.setSectionDisplay('section_name',false);
var sections = g_form.getSectionNames();
for(var i=0; i<sections.length; i++)
{
if(i == '0')
{
g_form.setSectionDisplay(sections[i],false);

g_form.setMandatory('incident',false);
g_form.setMandatory('inc',false);
g_form.setMandatory('vehicle',false);
}
}
}

If False:

 

function onCondition() {

g_form.setSectionDisplay('section_name',false);
var sections = g_form.getSectionNames();
for(var i=0; i<sections.length; i++)
{
if(i == '0')
{
g_form.setSectionDisplay(sections[i],true);


g_form.setMandatory('incident',true);
g_form.setMandatory('inc',true);
g_form.setMandatory('vehicle',true);

}
}
}

Once again thank you All..

View solution in original post

9 REPLIES 9

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Hiding of the fields should also be possible with a ui policy, that is the best way to do it.

Can you show the ui policy you have written to hide the fields based on category?

-Anurag

-Anurag

Hi Anurag,

 

Thanks for the reply

we tried to hide the fields through UI policy and it's working,  but the problem is we want few fields to be mandatory Before and After saving the form based on the category.

SO we tried using UI policy to make fields mandatory Before and After saving the form based on the selected category and it's working perfectly.

But at same to we want to hide the fields based the selected category.

so for that UI policy is not working and then we wrote client script to hide the fields but it's not working.

 

Advance thanks....

Brian Lancaster
Tera Sage

You should be able to do this with UI Policies.  However with Mandatory fields after save you will need an extra condition.  Maybe crate a field (true/false) that gets set by a business rule after the record is save and then use that to make the fields mandatory when that field becomes true.

Hi Brian,

Thanks for  your time...

 

SO we tried using UI policy to make fields mandatory Before and After saving the form based on the selected category and it's working perfectly.

But at same to we want to hide the fields based the selected category.

 

Advance thanks....