I have fieldname1 as lookup field and the other are fieldname2, fieldname3. After Insert new record, I want to make fieldname1 as READONLY field. I hope someone could help me. As I know it is difficult to achieve that, even though I have used AG JS Helper. Many thanks.
My regards,
Soewandi
How to make lookup field READONLY after INSERT
Re: How to make lookup field READONLY after INSERT
Sorry, I found the simple way . It can be achieve by setting "Hide in detail view"
Re: How to make lookup field READONLY after INSERT
Since you mentioned you have AG JS Helper, you can take a look at this info:
https://www.appgini.de/docs/Javascript- ... nable.html
https://www.appgini.de/docs/Javascript- ... nable.html
Re: How to make lookup field READONLY after INSERT
You can use JS to check for field's string length > 0 (not empty value) as a condition to disable it (set it as readonly) or hide it.
Re: How to make lookup field READONLY after INSERT
Hi,
I think hiding or using JS is not an option to really protect a field from being changed.
Thus I suggest you use hooks:
before_update -> read the field that should be readonly form the database, save it's value ti a variable.
Change the data[yourReadOnlyField] value to the value (variable) you just read from the DB.
This should make sure, the field can not be changed by the user. Note: If another user has worked on the same record, the value of the read only field in the DB may be different than the value shown on screen. To prevent concurrent changes, see the link in my footer.
Olaf
I think hiding or using JS is not an option to really protect a field from being changed.
Thus I suggest you use hooks:
before_update -> read the field that should be readonly form the database, save it's value ti a variable.
Change the data[yourReadOnlyField] value to the value (variable) you just read from the DB.
This should make sure, the field can not be changed by the user. Note: If another user has worked on the same record, the value of the read only field in the DB may be different than the value shown on screen. To prevent concurrent changes, see the link in my footer.
Olaf
Some postings I was involved, you might find useful:
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button
Multi Path Upload (MPU) / dynamic upload folder; SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button