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?
Comments
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; }
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
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. http://www.getfuelcms.com/user_guide/libraries/my_model/#hooks
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.
Just search for
assets_upload_max_width
assets_upload_max_height
Cheers.