How to make all fields readonly and mandatory in form using UI Policy?

akhileshv
Tera Contributor

I want to know whether there is any way to make multiple fields readonly together without using Client Script.

2 ACCEPTED SOLUTIONS

Danish Bhairag2
Tera Sage
Tera Sage

Hi @akhileshv ,

 

There is no other way apart from script(client) where u can add code to make all field read-only/mandatory.

Else UI policy which is sometimes pain.

 

Thanks,

Danish

 

View solution in original post

No, not possible to select more than one field, however you can try below code in UI policy script to see if it makes all fields read only based on condition , otherwise you have to settle for Client script. you can do this with ACL as well as that's the most preferred way of doing it.

 var fields = g_form.getEditableFields();
         for (var x = 0; x < fields.length; x++) {
           g_form.setReadOnly(fields[x], true);
}
Please hit like and mark my response as correct if that helps
Regards,
Musab

View solution in original post

6 REPLIES 6

No, not possible to select more than one field, however you can try below code in UI policy script to see if it makes all fields read only based on condition , otherwise you have to settle for Client script. you can do this with ACL as well as that's the most preferred way of doing it.

 var fields = g_form.getEditableFields();
         for (var x = 0; x < fields.length; x++) {
           g_form.setReadOnly(fields[x], true);
}
Please hit like and mark my response as correct if that helps
Regards,
Musab

Danish Bhairag2
Tera Sage
Tera Sage

Hi @akhileshv ,

 

There is no other way apart from script(client) where u can add code to make all field read-only/mandatory.

Else UI policy which is sometimes pain.

 

Thanks,

Danish