4

我有一个表单,并且需要 bindrequest 中的字段类型,getType 方法不能正常工作:

$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
 }}
4

1 回答 1

10

用这个:

foreach($form as $key => $per) {
    $per->getConfig()->getType()->getName();
}
于 2012-10-31T22:26:56.470 回答