- Member | 31
i'm creating forms dynamically based on data that specifies the form's structure.
every example i have found generates the control by attaching it to a form, like this:
$form = new Form; $form->addText("name", "Your name")->setRequired(),
but I'd like to be able to generate the control, then modify it according to my criteria, then finally add it to the form. PSEUDO CODE:
$control = new textControl("name", "Your name");// i made this up... $control->setRequired(); // ... do other stuff to $control ... $form->addComponent($control, 'name');
But i can't figure out how to actually do this. any suggestions?