Reputation: 422
I have a form, and need the field type in the bindrequest, the method getType dont works fine:
$peticion = $this->getRequest();
if ($peticion->getMethod() == 'POST')
{
$form->bindRequest($peticion);
if ($form->isValid()) {
foreach($form as $key => $per)
$per->getType(); // i want the type of item [text,checkbox,etc] the method getType() dont work
}}
Upvotes: 4
Views: 3555
Reputation: 2576
Use this:
foreach($form as $key => $per) {
$per->getConfig()->getType()->getName();
}
Upvotes: 10