XML configuration of Zend_Form: child nodes and attributes not always equal?

Posted by Cez on Stack Overflow See other posts from Stack Overflow or by Cez
Published on 2010-05-06T09:54:35Z Indexed on 2010/05/06 9:58 UTC
Read the original article Hit count: 215

A set of forms (using Zend_Form) that I have been working on were causing me some headaches trying to figure out what was wrong with my XML configuration, as I kept getting unexpected HTML output for a particular INPUT element. It was supposed to be getting a default value, but nothing appeared.

It appears that the following 2 pieces of XML are not equal when used to instantiate Zend_Form:

Snippet #1:

<form>
  <elements>
    <test type="hidden">
      <options ignore="true" value="foo"/>
    </test>
  </elements>
</form>

Snippet #2:

<form>
  <elements>
    <test type="hidden">
      <options ignore="true">
        <value>foo</value>
      </options>
    </test>
  </elements>
</form>

The type of the element doesn't appear to make a difference, so it doesn't appear to be related to hidden fields.

Is this expected or not?

© Stack Overflow or respective owner

Related posts about zend-form

Related posts about zend-form-element