- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 11:14 AM
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!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2019 03:44 AM
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.
Mark this answer correct or helpful if works!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 11:23 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 02:35 PM
You can make the UI policy or client script to run only on service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 03:50 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2021 10:45 AM
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