How to make a custom field read only in detail view??
This is just example:
1) Copy the file (only if it does not exist) from modules\Accounts\clients\base\views\record\record.php to custom\modules\Accounts\clients\base\views\record\record.php
2) Find your field in this file (for example: [industry])
array( 'name' => 'industry', 'readonly' => true, ),
Do you want to make a field as readonly in 'Detail view'?
yes, with coding , no matter admin or regular user.
We cant edit fields in Detail view.Which means it will be in read only right. If i misunderstood,Can you please elaborate?
Correct, I would like to create a textfield which only display data but disallow users from editing it.
Can you add below code to your module
create one file in below path
add below code
Then make repair and rebuild.
But I cannot get the field turns into readonly, I am using sugarcrm 7, any idea?
Can you please paste the code here?
What Ajay suggested has to work! In which module you are trying to do this?
Here 'module' represents your module and it should be proper. For example if you trying for Contacts module 'module' should be replaced with 'Contact', not Contacts. To find this search for the vardef file cache/modules/<Your Module>/YourModulevardef.php and see the key being used for $dictionary array.
Let us know your findings.
This will make the field readonly only in record view. But users will be able to edit the field from list view and sub-panel list view in this case.
If I am not mistaken, the question is: "How to make a custom field read only in detail view ??"
hey roman , thanks alot, your solution works great!!
Changes you made in record.php will be overwritten once you deploy the the record view layout again in studio. Its a know bug in sugar!
I believe that was corrected in 7.5.
Retrieving data ...