Basically our Forms works just like default Phalcon version. The main difference is possibility of using arrayed values. It is possible to add forms element with names as follow:
namespace Test\Forms;
use Vegas\Forms\Element\Text;
use Vegas\Validation\Validator\PresenceOf;
class Test extends \Vegas\Forms\Form
{
public function initialize()
{
$firstName = new Text('name[first]');
$firstName->addValidator(new PresenceOf());
$this->add($firstName);
$lastName = new Text('name[last]');
$lastName->addValidator(new PresenceOf());
$this->add($lastName);
}
}
Possible filled form data received by some endpoint may look like:
[
'name' => [
'first' => 'John',
'last' => 'Doe'
]
];
New in v1.1! All forms elements have now own decorators. Thanks too this
you can easily separate your php and volt/phtml code. Read more here.