2008年8月8日星期五

[fw-db] Zend Form Grouping Elements

Hello,

I have an element decorator for my elements and it is working corrent.

It looks like this:
public $elementDecorators = array(
'ViewHelper',
'MyErrors',
array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' =>
'element')),
array('Label', array('class' => 'left')),
array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'row')),
);

This renders code like this:
<div class="row">
<label for="txtUserName" class="required left optional">Name</label>
<div class="element">
<input type="text" name="txtUserName" id="txtUserName" value=""
size="30" maxlength="20" class="required" />
</div>
</div>

This is what I need :-)

But now my problem. Sometime I want to have two or more elements in
one row. Like perhaps zipcode and city.
This should be rendered like this:
<div class="row">
<label for="txtZipcode" class="required left optional">Zipcode/City</label>
<div class="element">
<input type="text" name="txtZipcode" id="txtZipcode" value=""
size="10" maxlength="10" class="required" />
<input type="text" name="txtCity" id="txtCity" value="" size="30"
maxlength="20" class="required" />
</div>
</div>


I think, that I need to use DisplayGroups to achieve this. But I don't
get it to work :-(
I think this is a common problem. So hopefully some can give me a hint
how my decorator needs to look like...

Thanks for your Help,
Stefan Sturm

没有评论: