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

Prateek kumar
Mega Sage

Add this read only attribute in your HTML code of Widget.

https://www.w3schools.com/tags/att_input_readonly.asp


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

dvp
Mega Sage
Mega Sage

You can make the UI policy or client script to run only on service portal

Yes by selecting UI Type "Mobile/ServicePortal" and entering "sp" in view field. But i am still curious how to achieve that on portal rather than on platform. 

Hi dvp,

do you know how can I write a client script / UI policy to run on service portal only? Kindly advise please.

Thanks,

Johannes