Dropdownlist readonly for role

I have transformed an editable dropdownlist only for certain roles.

But what I would like is that in editview it would show me the text and not the value at this point:

array (
            'name' => 'approvazione_c',
            'studio' => 'visible',
            'label' => 'LBL_APPROVAZIONE',
		'customCode' => '{if $ReadOnly == "readonly"}<span>{$fields.approvazione_c.value}</span>{else} ......................

but what is the correct syntax?

Thanks very much for your help.

It’s Smarty templates syntax.

The variables available to you are the ones that were assign 'ed in the view class code that renders the template.

I can’t understand how to retrieve text from smarty but I solved it this way and it could be useful to others:

{if $ReadOnly == "readonly"}<select name="approvazione_c" id="approvazione_c" disabled="true">{html_options options=$fields.approvazione_c.options selected=$fields.approvazione_c.value}</select>{else} ................

1 Like