Custom dropdown in form_fields()

I have a function in another model that will return an array in a format like

[1] => Option one
[2] => Option two
[3] => Option three

In my function form_fields($values = array()) what syntax do I need to add to create the dropdown?


  • edited September 2011
    Try this.

    function form_fields($values = array()) { $fields = parent::form_fields($values); $fields['myField'] = array('type' => 'select', 'options' = array('option1' => 'Option 1', 'option2' => 'Option 2'); return $fields; }
  • edited 5:04AM
    Thanks toymachiner62 that has worked.

    Is there a way to set the max upload width and height in the form_fields function?

    At the moment I have

    $fields['file_name'] = array('type' => 'file', 'upload_path' => $upload_path, 'overwrite' => TRUE);

    Also is your username anything to do with the skateboard company?

    Thanks for your help
  • Actually I made this name up based on the skateboard company when I was like 14 years old and have used it for lots of screennames ever since.

    You cannot specify the max upload width and height in the form_fields function. You'll want to use one of the hooks in your model to do the form input validation and in there you can set the max width and height.

    I highly recommend downloading the demo version off github because they have a module created in there called "projects" and they have a great example of how they use one of these hooks, and validate the file upload.
  • edited 5:04AM
    Or you can set the max upload width and height globally in fuel/application/config/MY_fuel.php

    Just search for


  • I was not aware of that. Thanks.
Sign In or Register to comment.