Enum Select

edited May 2012 in Modules
Sorry for the 1000 Questions.

I have a database table with a field with a list of enum values i.e

Cat 1
Cat 2
Cat 3
Cat 4
Cat 5

OK When the form gets created by default you will see a nice auto select with the above options.

If I then want to add a reference in to customize that field i.e

$fields['category'] = array('label'=>'Category','type'=>'select','options'=>'','','order' => '11');

The options field is blank. How do I get the system to auto fill the select with the values in the enum list within the database?

Thanks

Comments

  • edited 5:15AM
    By declaring the field that way, you are essentially replacing the current value and all of it's params. If you want to continue to use the default options, you can do one of the following:
    $fields['category']['mode'] = 'select';
    OR
    $options = $fields['category']['options']; $fields['category'] = array('label'=>'Category','type'=>'select','options'=>$options,'','order' => '11');
    OR
    $fields['category']['type'] = 'select'; $fields['category']['label'] = 'Category'; $fields['category']['order'] = 11;
  • edited 5:15AM
    Ahhh I see, thats cleared that up.

    Thanks again ;)
Sign In or Register to comment.