Here's an interesting problem (hope you'll agreee (-: ). I have a Zend_Form
to which 1 or more elements might be added to the DOM with Javascript.
Imagine something like an employment application where the applicant has the
opportunity to tell us how many languages she/he is proficient in. There's a
"languages" select element. When they choose one, we create a DIV containing
the textual name of the language and a hidden element, e.g.,  <...
name=languages[] value=23 />, holding the id. (I recognize that the downside
to this DOM-manipulation approach is that it won't degrade gracefully in the
absence of js support -- not worried about that.)

Hard to know how to add elements and validators at instantiation time since
I don't know how many elements there will be. Inside the form class' init()
I could get the request object out of the front controller instance, examine
the parameters and see how many elements to add along with their validators.

But I also think -- tell me if I am right -- from the server-side point of
view this is indistinguishable from a multi-select Zend_Form_Element_Select.
I could lie to Zend_Form about what kind of element I am using, and manually
display a regular select in its place in the view script. True?


-- 
Support real health care reform:
http://phimg.org/

--
David Mintz
http://davidmintz.org/

Reply via email to