Hi, I defined a custom sugar field (multi-checkbox) which basically works fine.
I noticed that all checkboxes receive the same id and tried to fixed it by introducing a counter variable that is appended to the id to make the id unique again.
However, introducing a counter variable seems to break the smarty script. At least the pages doesn’t load anymore.
How to correctly concat variables in a .tpl?
I added a counter variable (first line) and tried to concat it with the suite-crm field name
Here is the script:
{assign var=counter value=1}
<p style="height: {{$displayParams.size|default:9em}}; overflow: {{$displayParams.overflow|default:scroll}}; margin-bottom: 1.5em; width:{{$displayParams.width|default:80}}%" class="select"
{{if isset($displayParams.javascript)}}{{$displayParams.javascript}}{{/if}}>
<input type="hidden" id="{{sugarvar key='name'}}_multiselect" name="{{sugarvar key='name'}}_multiselect" value="true">
{multienum_to_array string={{sugarvar key='value' string=true}} default={{sugarvar key='default' string=true}} assign="values"}
{assign var=counter value=$counter+1}
{if isset({{sugarvar key='value' string=true}}) && {{sugarvar key='value' string=true}} != ''}
{html_checkboxes id="{{$vardef.name}-{$counter}}" name="{{$vardef.name}}" title="{{$vardef.help}}" options={{sugarvar key='options' string=true}} separator="{{$vardef.separator}}" selected=$values }
{else}
{html_checkboxes id="{{$vardef.name}-{$counter}}" name="{{$vardef.name}}" title="{{$vardef.help}}" options={{sugarvar key='options' string=true}} separator="{{$vardef.separator}}" selected={{sugarvar key='default' string=true}} }
{/if}
</p>
Best,