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

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Form element multiple select with setDefault


reffering to the post of Calin Rada https://forum.phalcon.io/discussion/4209/select-multiple-setdefault

i have set up my form element in the same way. But i get a "Array to string" error by the form-render function.


Notice: Array to string conversion in C:\xampp\htdocs\phalcon\app\cache....

Whats wrong in my code? Thanks for help.


$select = new Select("type[]", array(1 => 'PayPal', 2 => 'amazon', 3 => 'skrill'), array('useEmpty' => false, 'multiple' => true));

Volt file:

 <div class="row">
 <div class="col-md-10">
 <div class="form-group">
 {{ form.label('type[]', ['class' : 'control-label']) }}<br>
 {{ form.render('type[]', ['class' : 'form-control']) }}
 {{ form.messages('type[]') }}

Cache file:

<div class="row">
<div class="col-md-10">
<div class="form-group">
<?php echo $form->label('type[]', array('class' => 'control-label')); ?><br>
<?php echo $form->render('type[]', array('class' => 'form-control')); ?>
<?php echo $form->messages('type[]'); ?>


Try update to latest Phalcon version 2.0.4. It was fixed #10543


Thanks for your answer. I have to wait for the windows dll.