Did you ever figure this out? I'd like to know the solution as well. Thanks!
Hi everybody,
Here's my case. For a web application I have to create a form where elements (input boxes) can be added dynamicly by the user. I'm able to create this with jQuery and a normal HTML created form (thus no Zend_Form).
See jQuery Test - Adding Elements To A Form to get an impression of what I'm aiming at.
Of course my real-life form will not be as simple as this one so I will be using Zend_Form for that.
Now my question is, how can I create the same effect with Zend_Form? What if I want validators and filters attached to the dynamic element?
Thanks.
p.s.: I'm new to Zend Framework so if I overlooked something, please point me to it![]()
Did you ever figure this out? I'd like to know the solution as well. Thanks!
Hello Morfie,
To be honest with you I do not recall how I solved my problem back then. Right now the only thing I can come up with is to create a custom element and set it's $_isArray property to true.
All filters and validators you add to it will automatically be applied to all dynamic created forms than.
There are several ways to work with Zend_Form. One can create custom elements and override the render method, one can create custom decorators to change the way an element is rendered, one can create a custom view helper or one can use the ViewScript decorator in order to render a form/element. My advice is to play with Zend_Form a lot and just figure out what floats your boat.
Good luck.