This is one way to do it:
$city->removeDecorator('DtDdWrapper')
->addDecorator('HtmlTag', array(
'tag' => 'dd'
));
You'll get markup like this:
<dt id="zipcode-label"><label for="zipcode" class="required">Zipcode /
City</label></dt>
<dd id="zipcode-element">
<input type="text" name="zipcode" id="zipcode" value="" />
</dd>
<dd>
<input type="text" name="city" id="city" value="" />
</dd>
Then you can use CSS to make that second <dd> display inline.
On Thu, May 13, 2010 at 4:50 PM, Philip Iezzi <[email protected]> wrote:
> Hi,
>
> What I'm trying to accomplish is to group two Zend_Form_Element_Text elements
> that they show up on the same line.
> I'm styling my standard Zend_Form output (standard decorators) by CSS to
> bring the form element's label to the left side of the input field.
>
> $zipcode = new Zend_Form_Element_Text('zipcode', array('size' => 10));
> $zipcode->setLabel('City')
> ->setRequired(true);
>
> $city = new Zend_Form_Element_Text('city');
> $city->setLabel('Ort')
> ->setRequired(true);
>
> The rendered form produces the following:
>
> <dt id="zipcode-label"><label for="zipcode"
> class="required">Zipcode</label></dt>
> <dd id="zipcode-element">
> <input type="text" name="zipcode" id="zipcode" value="" />
> </dd>
> <dt id="city-label"><label for="city" class="required">City</label></dt>
> <dd id="city-element">
> <input type="text" name="city" id="city" value="" />
> </dd>
>
> Now I would like to group those two input fields together that they show up
> on the same line, say:
>
> <dt id="zipcode-label"><label for="zipcode" class="required">Zipcode /
> City</label></dt>
> <dd id="zipcode-element">
> <input type="text" name="zipcode" id="zipcode" value="" />
> <input type="text" name="city" id="city" value="" />
> </dd>
>
> Removing the HtmlTag & Label decorators of $city doesn't do the trick...
>
> $city->removeDecorator('HtmlTag')
> ->removeDecorator('Label');
>
> How can I attach the $city element into the HtmlTag decorator (dd-Tag) of the
> previous element? If possible, without building the whole form from scratch
> with a ViewScript decorator.
>
> Thanks a lot
> Philip