I have created a custom module and I have a number field which I want to make read only.
The problem I have is if i set the field to read only in the database by changing the display type to 2, it doesn't show on the edit view but does make the field read only in detail view.
I have created a a view in \layouts\v7\modules\<CUSTOMODULE>\uitypes which makes adds the readonly attribute to my specific field. This only works if the display type is set to 1.
Is there a way to keep my edit view so i can see the readonly field with it's value but also make the field readonly in detail view?
I did think about using javascript to return false on the edit button
I managed to solve this for anybody else facing the same problem
Here is what I did.
Create a new folder in
vtiger_root\layouts\v7\modules\ModuleName(will either bev7orvlayoutdepending what version of vTiger)Create a new folder in the new folder called
vtiger_root\layouts\v7\modules\ModuleName\uitypesCopy from
vtiger_root\layouts\v7\modules\Vtiger\uitypes, the field type tpl file into folder created in step 2 (in my case I copied theNumber.tplfile)Add the following code just before the closing
/>replacing 'yourfield' with the field nameCopy from
vtiger_root\layouts\v7\modules\Vtiger, filesDetailViewBlockView.tplandDetailViewFullContents.tpland place them in your new module folder created in step 1In the
DetailViewFullContents.tplfile look for the line containingand replace it with