find('list', array('fields' => array('CONCAT(field1, field2) AS field3', 'field4'), "order" => array("created desc"))); $options = $data; $field = array ( 'name' => 'fltr[field3][field4]', 'id' => '', 'options' => array ( ), 'empty' => 'Select...', 'values' => array ( ), 'label' => array ( 'text' => '', 'position' => 'left', ), 'sublabel' => '', 'multiple' => '0', 'size' => '', 'class' => 'form-control', 'title' => 'Type', 'style' => '', 'params' => '', ':data-load-state' => '', ':data-tooltip' => '', 'type' => 'dropdown', 'container_id' => '0', ); $field["options"] = $options; echo \GCore\Helpers\Html::formLine($field["name"], $field);?>"> Concat fields in dynamic dropdown - Forums

Forums

Concat fields in dynamic dropdown

cesarvelame 29 Oct, 2015
Based in this topic: http://www.chronoengine.com/forums/posts/f12/t95664/how-to-create-a-dynamic-drop-down-list.html

How to concat 2 fields?

I saw this tip, but I didn't make it work:

Use
CONCAT("filialka_id", "city") or :CONCAT("filialka_id", "city") in one of the fields.

My code:

<?php
      \GCore\Libs\GModel::generateModel("Drop", array('tablename' => "jri8z_chronoengine_chronoforms_datatable_concurso",));
      $class = '\GCore\Models\Drop';
      $data = $class::getInstance()->find('list', array('fields' => array('CONCAT(field1, field2) AS field3', 'field4'), "order" => array("created desc")));
      $options = $data;
      $field = array 
      (
        'name' => 'fltr[field3][field4]',
        'id' => '',
        'options' => 
        array (
        ),
        'empty' => 'Select...',
        'values' => 
        array (
        ),
        'label' => 
        array (
          'text' => '',
          'position' => 'left',
        ),
        'sublabel' => '',
        'multiple' => '0',
        'size' => '',
        'class' => 'form-control',
        'title' => 'Type',
        'style' => '',
        'params' => '',
        ':data-load-state' => '',
        ':data-tooltip' => '',
        'type' => 'dropdown',
        'container_id' => '0',
      );
      $field["options"] = $options;
      echo \GCore\Helpers\Html::formLine($field["name"], $field);
?>
This topic is locked and no more replies can be posted.