Change a field to checkbox in the model

edited November 2014 in Modules
Hi,

I've developed a model, one of the field will be call "fuel_categories_model" to get the data and these data I would like to show in a checkbox mode.

I tried by it doesn't show in checkbox mode, below is my coding in my model.

... public $foreign_keys = array( 'location_id' => array(FUEL_FOLDER => 'fuel_categories_model', 'where' => array('context' => 'LOCATION')), 'area_id' => array(FUEL_FOLDER => 'fuel_categories_model', 'where' => array('context' => 'AREA')), 'type' => array(FUEL_FOLDER => 'fuel_categories_model', 'where' => array('context' => 'TYPE DETAILS')) function form_fields($values = array(), $related = array()) { $fields = parent::form_fields($values, $related); $fields['categories_id']['label'] = 'Categories'; $fields['position']['label'] = 'Position'; $fields['location_id']['label'] = 'Location'; $fields['area_id']['label'] = 'Area'; $fields['type'] = array('label' => 'Type', 'type' => 'multi', 'options' => array('type' => array(FUEL_FOLDER => 'fuel_categories_model', 'where' => array('context' => 'TYPE DETAILS')))); return $fields; } ...

Am I correct?

Many thanks.

Comments

  • edited November 2014
    Seems that I should be use "Tags" for my "type" in model as it is multi.

    I've changed to:
    ... public $foreign_keys = array( 'location_id' => array(FUEL_FOLDER => 'fuel_categories_model', 'where' => array('context' => 'LOCATION')), 'area_id' => array(FUEL_FOLDER => 'fuel_categories_model', 'where' => array('context' => 'AREA')) ); public $has_many = array( 'type' => array(FUEL_FOLDER => 'fuel_tags_model') ); ...

    Thanks a lot.
Sign In or Register to comment.