Zend_Form has a lot of different facilities to add custom XHTML, it's
really
up to you to decide how best to use them to implement your form. At
the end of
the day you're not even required to use the built in form rendering to
still
get use from the module.
For your particular situation I would recommend using the ViewScript
decorator
and attaching it either to a new element or to an element related to the
preview. Remember that just because you don't want to specifically use
the
data associated with an element doesn't mean you can't still use a
Zend_Form_Element to represent some part of your form!
I use a view script like this for all my javascript driven form
widgets. It's
fairly clean way of separating the required XHTML from other parts of
the form
and I can put anything I want in a view script, including custom logic.
Good luck!
--
Mathew Byrne
On Mar 25, 2008, at 3:46 AM, dankh wrote:
I'm not Zend_Form guru but I've been playing with it since the begging
(incubator). There is something quite common that I didn't managed
to make
it with the current implementation.
Short description of the problem: How to inject pure (X)HTML code in
any
part of the form, without breaking the current Zend_Form workflow ?
Long description: I want to display some blocks (DIV or P elements)
in the
middle of the form. These block are not related to any of the form
elements.
To create a decorator isn't a solution because the blocks will not
decorate
any element. To extend Zend_Form_Element_* is not a solution either
because
these blocks will not be filtered, validated, and in general don't
met the
properties of a Zend_Form_Element.
For exemple I want to insert a preview block in the middle of the
form which
interacts with the elements but it's controlled via javascript code.
This
kind of blocks are valuable at the "display" state of the form and
they are
inexistent in the filtering, validation, "submit" stage. It's close to
decorator but "not element related decorator".
In Zend_Form as it is today, I can do this kind of layouts, but it's
not
"clean". What I do is attach the block to one of the form elements.
This way
the block is some kind logically dependent on one of the form
elements,
which is not true, it's a component/element of the form in general.
Thanks for any suggestions, comments.
Daniel
--
View this message in context:
http://www.nabble.com/Zend_From-inject-xhtml-in-the-form-tp16255932s16154p16255932.html
Sent from the Zend Framework mailing list archive at Nabble.com.