Another customCode Question for Smarty Templates

@pstevens

I want to add two examples for customCode, how to use multiple fields in one block.

  1. Add an extension text field to multienum type.
  • vardef.php
...
'fields'=>array (
...
        'inspection' => array(
            'required' => '0',
            'name' => 'inspection',
            'vname' => 'LBL_INSPECTION',
            'type' => 'multienum',
            'massupdate' => 0,
            'comments' => '',
            'help' => '',
            'importable' => 'true',
            'duplicate_merge' => 'disabled',
            'duplicate_merge_dom_value' => 0,
            'audited' => 0,
            'reportable' => 0,
            'options' => 'bfhcav_inspection_list',
            'studio' => 'visible',
            'isMultiSelect' => true,
            'inline_edit'=>false,
        ),
        'inspection_ext' => array (
            'required' => false,
            'name' => 'inspection_ext',
            'vname' => 'LBL_INSPECTION_EXT',
            'type' => 'text',
            'massupdate' => 0,
            'no_default' => false,
            'comments' => '',
            'help' => '',
            'importable' => 'true',
            'duplicate_merge' => 'disabled',
            'duplicate_merge_dom_value' => '0',
            'audited' => false,
            'reportable' => true,
            'unified_search' => false,
            'merge_filter' => 'disabled',
            'len' => '255',
            'size' => '20',
            'inline_edit' => false,
        ),
...
),
...
  • editviewdefs.php
...
1 => array (
                        'name' => 'inspection', 
                        'customCode' => '<span>
                                @@FIELD@@
                            </span>
                            <span style="display:inline-block;width:100%;margin:5px;">
                                <span class="label" style="margin:5px;line-height:10px;float:left">{$MOD.LBL_INSPECTION_EXT}</span>
                                <textarea name="inspection_ext" id="inspection_ext" rows="3" cols="80" title="" tabindex="0" value="">{$fields.inspection_ext.value}</textarea>
                            </span>',
                    ),
...
  • detailviewdefs.php
...
1 => array (
                        'name' => 'inspection', 
                        'label' => 'LBL_INSPECTION_DETAILVIEW',
                        'customCode' => '
                            {multienum_to_array string=$fields.inspection.value assign="vals"}
                            {foreach from=$vals item=item}
                                <li style="margin-left:10px;line-height:1.428571429;" value="$item">{ $APP_LIST_STRINGS.bfhcav_inspection_list.$item }</li>
                            {/foreach}
                            <span style="display:inline-block;width:100%;margin:5px;">
                                <span name="inspection_ext" id="inspection_ext">{$fields.inspection_ext.value}</span>
                            </span>',
                    ),
...