We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

DImension form

Is it possible to generate multi dimension form:

In my volt i have

{{ form.render('myselect',{'name' : 'properties[house]'}) }}

And in my form i have

$select = new Select('myselect');
$select->setOptions(['1' => 'One','2'  => 'Two']);
$select->addValidators([new PresenceOf(['message' => 'Option is required'])]);
$this->add($select);

But it's not working, phalcon do not remember value, and valdiator also do not work. I try to change myselect into properties[house] and still it doesn't work like this

$select = new Select('properties[house]');
$select->setOptions(['1' => 'One','2'  => 'Two']);
$select->addValidators([new PresenceOf(['message' => 'Option is required'])]);
$this->add($select);

and then in volt

{{ form.render('properties[house]') }}
edited Dec '17

I also usually do

$select = new Select('myselect', $options);

"Doesn't work" doesn't tell us much. What happens? What's the generated HTML?