How to make certain fields read only after submitting (save) the form.

Sourabh26
Giga Guru

I have to make User, Description, Return type, From & To fields read only after save the form.

find_real_file.png

8 REPLIES 8

ARG645
Tera Guru
Sourabh,

Write an Onload Client Script something like below

// Check if its not a new record, basically you are checking if you already saved it
if(!g_form.isNewRecord()) 
{
  //***Change the column names [1st parameter] as per your needs****//
  g_form.setReadOnly('user', true);
  g_form.setReadOnly('description', true);
  g_form.setReadOnly('return_type', true);
  g_form.setReadOnly('to', true);
  g_form.setReadOnly('from', true);
}

Thank you,

Aman Gurram

This does assume that he meant this should apply to new records only.

 

The only way I've found to apply the same sort of restriction on an already existing record is via a 'write' ACL on the table/field.  The ACL won't apply until the condition is met after the record is saved. 

Community Alums
Not applicable

Aman's reply is correct regarding the client script. Meantime please be aware and make sure you know the difference between a CS and a UI Policy. Link here difference between a Client script and an UI policy.

Shivaa1
Tera Contributor

I am a beginner and I would like to know the difference between the CS and the policies interfaces. Thanks for the article.