Ok, giving it a few more thoughts, there is a way in Zend_Form for this (if there is a better one, I'd be delighted to learn about it ;) ). You can define a new ViewHelper decorator for your readonly field. Here is what I did.

Create a new ViewHelper and make it available to the form:

class My_View_Helper_FormReadonly extends Zend_View_Helper_FormHidden
{
public function formReadonly($name, $value = null, array $attribs = null)
   {
       $hidden = $this->formHidden($name, $value, $attribs);
       $str = $hidden . '<span>' . $value . '</span>';
       return $str;
   }
}

The View_Helper creates a hidden field and displays the value in a span which can hold all HTML attributes needed. The only thing to do now is define the new View_Helper as the decorator for the field:

$elemtent->addDecorator('ViewHelper', array('helper' => 'FormReadonly'));

Greetings,
Florian


Alex Buell schrieb:
Anton Mckee wrote:
On Fri, Aug 1, 2008 at 2:26 PM, SexyAlexy <[EMAIL PROTECTED]> wrote:
<table>
<tr>
<td>content<td><td><input type="hidden" name="wibble"
value=<?=$record["field1"]?>/><?php echo $record["field1"]; ?></td>
</tr>
</table>


Yeah, but I'm doing this by adding elements to the Zend_Form which I've
designed. There has to be a way to add an element like the above!


-----
Regards,
Alex

Reply via email to