Hello
In the following form, phone type and phone number can appear an infinite number of times (the "Add" link is handled by Javascript):
How am I suppose to code this with Phalcon, both when saving a new record (start with one empty phone number) and when editing an existing one (start with x existing phone numbers)?
class MyForm extends Form
{
public function initialize()
{
$field = new Text('name');
$field->setLabel('Name');
$this->add($field);
$field = new Select('phone_type',
Models\PhoneLineType::find(),
['using' => ['id', 'name']]
);
$this->add($field);
$field = new Text('phone_number');
$this->add($field);
}
}
// View
foreach (?? as ??) { ?>
<div>
<?= $form->render('phone_type') ?>
<?= $form->render('phone_number') ?>
</div><?php
}
Thanks in advance!