Hello,
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.
Message:
Notice: Array to string conversion in C:\xampp\htdocs\phalcon\app\cache....
Whats wrong in my code? Thanks for help.
Form-Class:
$select = new Select("type[]", array(1 => 'PayPal', 2 => 'amazon', 3 => 'skrill'), array('useEmpty' => false, 'multiple' => true));
$select->setLabel('Beratertyp');
$select->setDefault(array(1,2));
$this->add($select);
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[]') }}
</div>
</div>
</div>
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[]'); ?>
</div>
</div>
</div>