how to make fields ''ReadOnly'' in client script onSubmit.

Kishore8
Kilo Guru

how to make field

how to make fields ''ReadOnly''   in client script onSubmit.

7 REPLIES 7

Aakash Shah4
Tera Guru

Hi,



I would rather suggest to use a UI policy for making fields readonly


For making readonly through client script you can use this g_form.setReadOnly()



GlideForm (g form) - ServiceNow Wiki


Zeeshan Khan1
Kilo Guru

Hi Kishore,



Can you explain the use case for this requirement ?


By the time you will make the fields read only the user would have already updated the fields.


Gaetano De Mitr
ServiceNow Employee
ServiceNow Employee

g_form.setReadOnly('fieldname',true); // set read only


g_form.setReadOnly('fieldname',false); // unset read only field



Regards,


Harish KM
Kilo Patron
Kilo Patron

Why would you want to make read only after submit? Whats the use case? I would prefer ACL in this case


Regards
Harish