read-only field on Service Portal only

manibaig
Mega Guru

Cloned the "Form" widget and now trying to make couple of fields read-only. Can't use UI policy/BR/ etc. It needs to be done on portal only. appreciate the help!

 

1 ACCEPTED SOLUTION

Alok Kumar2
Tera Expert

Hi,

Actually you can do that on the cloned version of your form widget itself.

Try to search for g_form = gFormInstance; line in client controller and then below this you can use usual g_form function like g_form.setReadonly(). I did this for the number field in personal instance where number is an editable field at backend on the incident form, but i wrote the g_form.setReadOnly() function for the number field it became read only on form page in portal.

However, i would suggest you to be careful while adding the functions on the form widget's controller because this is going to be used for various others tables too. So make sure you are doing the necessary checks like for table name,etc. find_real_file.png

 

Mark this answer correct or helpful if works!!

View solution in original post

7 REPLIES 7

Alok Kumar2
Tera Expert

Hi,

Actually you can do that on the cloned version of your form widget itself.

Try to search for g_form = gFormInstance; line in client controller and then below this you can use usual g_form function like g_form.setReadonly(). I did this for the number field in personal instance where number is an editable field at backend on the incident form, but i wrote the g_form.setReadOnly() function for the number field it became read only on form page in portal.

However, i would suggest you to be careful while adding the functions on the form widget's controller because this is going to be used for various others tables too. So make sure you are doing the necessary checks like for table name,etc. find_real_file.png

 

Mark this answer correct or helpful if works!!

You rock!

sunil14
Tera Contributor

how can i make the quantity as read only and i need to set it to default value as '1'find_real_file.png