AnsweredAssumed Answered

Dependency for all fields readonly based on a fields value ( checkbox) ?

Question asked by learningsugar on May 1, 2020
Latest reply on May 4, 2020 by Poojitha Katram

Working with Professional, Version 9.0.0
I`m new into SugarCRM, I have a little question. 
The case is: I Make fields read-only ( most ) but not only one ( the checkbox) in module Quote.
When I click the checkbox all fields must be read-only and when I uncheck the fields be must editable.


I write a dependency looks like : 


$allFields = $GLOBALS['dictionary']['Quote']['fields'];
foreach ($allFields as $field => $val) {
    if($field == 'approved_c'){
    $dependencies['Quotes']['readonly_' . $field . '_dep'] = array(
        'hooks' => array('all'),
        'trigger' => 'true',
        'triggerFields' => array('approved_c'),
        'onload' => true,
        'actions' => array(
                'name' => 'ReadOnly',
                'params' => array(
                    'target' => $field,
                    'label' => $field . '_label',
                    'value'  => 'equal($approved_c, 1)',



approved_c is my checkbox. 

So it works but not correct because when I uncheck the field and click save I have an error in the browser console : 


Uncaught TypeError: Cannot read property 'setValue' 

And my DateTime fields look like:


Date Created
[object Object] by Administrator

Any suggestions?