views:

148

answers:

0

Hi all. I've spend all the day trying to set the Zend_Form decorators for the following format:

<dt>
  <label for="square_meters">The label</label>
</dt>
<dd>
  <input type="text" name="square_meters" id="square_meters" />
  <div class="description-div">m2</div>
</dd>

I got it. Currently this is working with the following array:

$descriptionDecorator = array(
  array('Label', array('tag' => 'dt')),
  array("HtmlTag", array('tag' => 'dd', "openOnly" => true)),
  array('ViewHelper'),
  array('Description', array("tag" => "div", "class" => "description-div", "placement" => "append")),
  array(array("ddClose" => "HtmlTag"), array('tag' => 'dd', "closeOnly" => true, "placement" => "append")),
);

The problen is when I want to display the errors. They have been located in a place where I don't want.

I want:

<dt>
  <label for="square_meters">The label</label>
</dt>
<dd>
  <input type="text" name="square_meters" id="square_meters" />
  <div class="description-div">m2</div>
  <ul>
    <li>Error ...</li>
  </ul>
</dd>

But I have:

<dt>
  <label for="square_meters">The label</label>
</dt>
<dd>
  <input type="text" name="square_meters" id="square_meters" />
  <ul>
    <li>Error ...</li>
  </ul>
  <div class="description-div">m2</div>
</dd>

With the following array:

$descriptionDecorator = array(
  array('Label', array('tag' => 'dt')),
  array("HtmlTag", array('tag' => 'dd', "openOnly" => true)),
  array('ViewHelper'),
  array('Description', array("tag" => "div", "class" => "description-div", "placement" => "append")),
  array('Errors'),
  array(array("ddClose" => "HtmlTag"), array('tag' => 'dd', "closeOnly" => true, "placement" => "append")),
);

Basically, what I want is to change the displayed order between Description decorator and Errors decorator.

Any help will be very welcome. Thanks a lot!

pd: Sorry for the mess!