How to set a form field to read-only on condition?
I have a requirement where a particular field in a form need to be set to read-only, once the user populate it with a text/data and submit it (commit it to the database). The next time the form is displayed with existing data, the user cannot modify the field any more. I can achieve this by creating two forms: one form has the field NOTset to read-only so that the user can enter the data and submit. The other form has the same field set to read-only mode and used when the user retrieves the old record.
However this is like over-kill, as there are a lot of forms in my app and I have to duplicate them one by one just to achieve this.
Is there any way to set read-only attribute of the field (e.g a text field) to read only dynamically in the same form when certain criteria is met?