Editable Read Only Fields while form loads

pkmithun
Kilo Contributor

Hi,

I am setting couple of fields to read only in my incident form based on certain conditions. However, while the form loads these fields remain editable and user can change the values. Once the form completes loading it becomes read only with the new value. Is there any solution here - other than ACL?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

If the fields are being set conditionally, it usually means someone is using a client script or UI policy. In that case, the laws of (Internet) physics say that the content needs to be loaded before it's rendered. ACLs won't do this conditionally (live as data changes), but can react to changing values when the record is saved.



Yes, you can do this with ACLs, just not "live" changes to the read-only status of those fields without a save/submit/update operation on the record. It depends if your requirements will allow for such a thing to determine if you can avoid what you are seeing.



Another thing to try... determine what order the scripts are running in. You may be able to take the UI policy or client script that does the read-only thing and make it a lower order (even a negative number) to run first. That will reduce the likelihood of someone being able to edit values on load.


View solution in original post

4 REPLIES 4

Chuck Tomasi
Tera Patron

If the fields are being set conditionally, it usually means someone is using a client script or UI policy. In that case, the laws of (Internet) physics say that the content needs to be loaded before it's rendered. ACLs won't do this conditionally (live as data changes), but can react to changing values when the record is saved.



Yes, you can do this with ACLs, just not "live" changes to the read-only status of those fields without a save/submit/update operation on the record. It depends if your requirements will allow for such a thing to determine if you can avoid what you are seeing.



Another thing to try... determine what order the scripts are running in. You may be able to take the UI policy or client script that does the read-only thing and make it a lower order (even a negative number) to run first. That will reduce the likelihood of someone being able to edit values on load.


Thanks Chuck!



Let me try to give a lower order. Hope it will solve this to an extent.



Similarly, I want to prevent the form being submitted during load(Some people are always in a hurry. Don't have enough time to wait). I came across a Global UI Script, which is disabling gsftSubmit object during load.



var gsftSubmitHolder = gsftSubmit;


gsftSubmit = function() {


alert('Page is still loading');


};


addAfterPageLoadedEvent( function() {


gsftSubmit = gsftSubmitHolder;


});



Will this prevent a UI action on server side from being submitted?


I haven't seen that approach before. It may be worth a try, but it could also impact other pages. Test carefully and thoroughly.


Arindam Ghosh
Mega Guru

You can use UI Policy/Client Script. Based on the condition you can make the field readonly.



Thanks,


Arindam