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

Then You can better go with UI policy and specify those fields in related list under UI action


In Fuji patch 4 (at least), g_form.getEditableFields() does not return currency fields.   So, after using the snipped to set the other fields readOnly, I had to manually specify the currency fields.



I opened an incident with HI to report this but HI says that   g_form.getEditableFields() is not documented / supported.


awesome man thats slick


Hi Simon, This has been very helpful..   Many Thanks, Rachana


YRK
Tera Contributor

Hi Simon,



I found that it is not working in mobile view. So it would give a problem while you are making the form same as desktop view.


can you please let me know if you have any script that can work for both mobile and desktop view for making all fields on the form readonly.




Thanks in advance!!