Currently I can add a Zend Form element dynamically to a form after it is first loaded. I do this through a mouse click and some ajax. However, I want to add the exact same element with a different name (basically I am giving each element an id). However, when I add the field it just shows up like a normal field and isn't Dojo'fied.
+1
A:
Dojo Form elements have to be initialized. This usually happens when the page is served to the browser when the DOM is ready. Dojo will parse the page and startup the form elements. When you get the elements through Ajax or create them dynamically, you have to startup the new elements again. I remember this to be somewhat tricky though.
See these related questions:
- http://stackoverflow.com/questions/1170693/cannot-create-dijits-via-dojo-nodelist-instantiate
- http://stackoverflow.com/questions/1175374/dojo-how-do-you-reinitiate-form-elements-after-ajax-call
- http://stackoverflow.com/questions/1590635/dojo-parser-parse-only-working-first-time-its-called
- http://www.dojotoolkit.org/forum/dijit-dijit-0-9/dijit-support/dijit-parse-after-ajax-call-again
Gordon
2010-01-24 18:32:04
Thanks, I looked over those and decided that I am going to preload a few and hide them instead. Seems like that way is going to be to difficult to get working.
Joe
2010-01-25 18:05:15