The CreatorCon Call for Content is officially open! Get started here.

Make all form fields read-only (client script)

brumiou
Mega Guru

Hi,

I need to put all the fields of a form read-only. I need to use a client script for that, because in certain case I will need to have some fields editable.

Is there another way than put all the fields in a ui policy (or a client script)?

Is suppose there is a way to do such a thing :

get references to all fields of the form

while(...)
{
referenced field.setreadOnly()
}

Thanks a lot

rgds

Xavier

16 REPLIES 16

Anurag Tripathi
Mega Patron
Mega Patron

Any reason to do it on client script and not ACL?

ACL would lock the fields from all UI (portal/native/mobile)and even on the list view. 

 

-Anurag

For multiple fields or specific use cases, a Client Script might be easier to implement than an ACL. But ACL would also be the more secure option as it runs on the server. Client Scripts and UI Policies can technically be disabled through the browser developer tools.