I followed the tutorial here: http://framework.zend.com/manual/1.12/en/zend.form.advanced.html on creating a multi-page form in Zend Framework. However, I'm displaying the form slightly differently and it's led to unexpected behavior. If I display the form like this:
<?php echo $this->form; ?>
I end up with the expected input with name="user[username]":
<dt id="user-username-label">
<label for="user-username" class="required">Username:</label></dt>
<dd id="user-username-element">
<input type="text" name="user[username]" id="user-username" value="" /></dd>
However, if I want a little more control over how the individual form elements are displayed:
<?php echo $this->form->username; ?>
I get name="username":
<dt id="username-label">
<label for="username" class="required">Username:</label></dt>
<dd id="username-element">
<input type="text" name="username" id="username" value="" /></dd>
What's interesting is that the submit button gets the correct name="user[submit]" either way. What gives? Is there something Zend_Form::__toString()
or Zend_Form::render()
that I'm missing?