klox7 VIP
Total posts: 914
24 Sep 2014 07:29

Hi,

I don't know if this is a problem or not but when I use two fields with same label and with code bellow the field with lower id is not visible. This is code from record template.

<?php if(isset($this->item->fields_by_groups[null])):?>
    <dl class="dl-horizontal fields-list">
        <?php foreach ($this->item->fields_by_groups[null] as $field_id => $field): ?>
            <dt id="<?php echo 'dt-'.$field_id; ?>" class="<?php echo $field->fieldclass;?>">
                <?php if($field->params->get('core.show_lable') > 1):?>
                    <label id="<?php echo $field->id;?>-lbl">
                        <?php echo $field->label; ?>
                        <?php if($field->params->get('core.icon')):?>
                            <?php echo HTMLFormatHelper::icon($field->params->get('core.icon'));  ?>
                        <?php endif;?>
                    </label>
                    <?php if($field->params->get('core.label_break') > 1):?>
                    <?php endif;?>
                <?php endif;?>
            </dt>
            <dd id="<?php echo 'dd-'.$field_id; ?>" class="<?php echo $field->fieldclass;?><?php echo ($field->params->get('core.label_break') > 1 ? ' line-brk' : NULL) ?>">
                <?php echo $field->result; ?>
            </dd>
        <?php endforeach;?>
    </dl>
    <?php unset($this->item->fields_by_groups[null]);?>
<?php endif;?>
Comments have been disabled for this article and works only in read only mode.

Sergey
Total posts: 13,748
24 Sep 2014 07:43

Because fields by group uses key. So you have the same key on both fields. Just think out a way to nake it differently.


klox7 VIP
Total posts: 914
24 Sep 2014 07:47

Sergey Because fields by group uses key.

Field key? But it's different for every field.


Sergey
Total posts: 13,748
24 Sep 2014 10:35

Field key is the same for fields with the same name and type. This is magic of fields merge from different types.

Powered by Cobalt