setVisible for more number of fields.

Ramkumar Thanga
Mega Sage

I got a requirement to make around 30 + fields are to be visible for specific conditions. Can I use the array(to store the field names) and loop condition as below with a onchange client script to set the visibility.

var fieldArray = ['field_name01', 'field_name02', 'field_name03',....................................'field_nameN'];

for(var i=0;i<fieldArray.length;i++){
   
g_form.setVisible(fieldArray[i],true);
}

 

 

 

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @Ramkumar Thanga,

 

You sure can. That is definitely one way to implement your requirement.

Another option (thinking out loud) could be to contain all the fields within a 'Container' if you're working with Catalog items or a form 'section' if working with a back-end form.

Using this approach you could place all the required fields within a container/section and just show/hide the container/section as required.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

View solution in original post

3 REPLIES 3

Robbie
Kilo Patron
Kilo Patron

Hi @Ramkumar Thanga,

 

You sure can. That is definitely one way to implement your requirement.

Another option (thinking out loud) could be to contain all the fields within a 'Container' if you're working with Catalog items or a form 'section' if working with a back-end form.

Using this approach you could place all the required fields within a container/section and just show/hide the container/section as required.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

Hi @Robbie 

 

Can we hide the containers in portal using on change client script.

 

Thanks!
Ram

Hi @Ramkumar Thanga,

 

Have you built a Catalog Item or Record Producer with containers and variables which you're displaying in the Portal? Theoretically, a Cat Item or Record Producer with functionality implemented with Client Scripts etc should act the same, however theory and practice are not always the same... how are you building the Portal page?

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie