Our blog

 

Zend Framework Form HTML Array Notation

After losing an afternoon trying to get my extended Zend Dojo Form class to give me HTML array notation, I have finally found a solution that works. To celebrate I've decided to share it should anyone else suffer a similar problem.

Here is the method:

PHP:
  1. public function addSubFormEl($subFormName, $addElOptions){
  2.         call_user_func_array(array($this,'addElement'), $addElOptions);
  3.         $this->getElement($addElOptions[0])->setBelongsTo($subFormName);
  4.     }

In one move, this creates the element and assigns it to a HTML array of the name $subFormName. Evidently I am using this with sub forms but there is no reason why you should have to do that.

More Reading:

Comments are closed.