AnsweredAssumed Answered

"Readonly" field becomes writable when its visibility changes

Question asked by Alx on Oct 13, 2014
I have created a readonly field by using the type 'readonly' in custom/Extension/modules/Account/Ext/Vardefs/sugarfield_syncstatus.php:
$dictionary['Account']["fields"]['syncstatus']['name'] = 'syncstatus';
$dictionary['Account']["fields"]['syncstatus']['vname'] = 'LBL_SYNCSTATUS';
$dictionary['Account']["fields"]['syncstatus']['type'] = 'readonly';
$dictionary['Account']["fields"]['syncstatus']['dbtype'] = 'varchar';
 
I went to Studio and added a dependency, which was stored in the same file like this:
$dictionary['Account']['fields']['syncstatus']['dependency']='equal($dotb_man01,"1")';
(dotb_man01 is a checkbox: I want my readonly field to be visible only when this checkbox is checked)

If I go to the Record view, everything seems right: the field is readonly, and it is toggled by the checkbox.
Unfortunately, if I click on the Edit button, the readonly field becomes a text field: a text box appears and I can type text in it. Even worse: if I type something in the text field, it is saved in the database.

Is this a known bug? Is there a workaround? Or do I do it the wrong way?

I would be grateful for any help.

Alexandre

Outcomes