We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Select multiple default values from controller, how to?

I'm trying to set default values of a multiple select field from the controller but it's not working. I'm using "$this->tag->select" in the view with the name "select[]".

From the controller, I'm trying to use "$this->tag->setDefault('select', $default_values_array);" but it's not working because setDefault doesn't accept non scalar values.

How can I make it work?


$defaultvaluesarray has to be an array with the values of the OPTIONs ([value1, value2, ...]).


I know this is old, but for future reference (this is phalcon 2.0.9):

$form = new EntityForm($entity, ['edit' => true]);