I found a good looking class for form creating. Hovewer I need to create forms dinamically, using output from database. Forms are being created this way:
$form->addElement(new Element\Textbox("Name:", "Name", array(
"required" => 1
)));
So, If I want to add a different form I have to change new Element\Textbox
to new Element\Password
. Is it possible to create forms based on database results something like this:
foreach ($fields as $field) {
$form->addElement(new Element\$field->type("Name:", "Name", array(
"required" => 1
)));
}
Right now it looks not right for me, and of course it's not working. So my question is, can I output this forms dinamically in different way, or should I check for another class ?