Other view form helpers check for a set XHTML doctype.
FormHidden depends on the _hidden function in the FormElement class, which does 
not check the doctype.

So there defenitly is a inconsistentcy.
I think this is something for the tracker

You can overcome this problem by setting the doctype in your bootstrap or a 
plugin but not in a view script.

Cheers,
Holger


-----Original Message-----
From: Friedhelm Betz [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 01, 2008 3:58 PM
To: [email protected]
Subject: [fw-general] Zend_Form: hidden fields

Hi,

Newbie question about hidden fields default rendering (ZF 1.5.0).

My simple, standalone form:

<?php
require_once('Zend/Loader.php');
Zend_Loader::registerAutoload();
$form = new Zend_Form();
$form->setAction('foo.php');
$form->addElement('hidden', 'foo', array('values' => 'foobar'))
          ->addElement('text', 'username', array('label' => 'username'))
          ->addElement('password', 'password', array('label' => 'password'))
          ->addElement('submit', 'login');
$form->setView(new Zend_View());
echo $form;
?>

The hidden field renders with self-closing tag:
<input type="hidden" name="foo" value="" values="foobar" id="foo" />

other fields render without self-closing tag (for example):
<input type="text" name="username" id="username" value="">

This happens also with Zend_Form_Element_Hash.

Is this expected behavior? At least, it seems inconsistent to me.

Thanks,
Friedhelm


Reply via email to