Steve Rayner wrote:
I'm trying to get rid of the default decorators in zend form.
I don't want the dl, dt & dd tags.
<snip/>
is there a simple way to turn off this feature for all forms. I'm finding that
these tags are making my css more complicated than it needs to be.
Hi Steve,
I also hated the <dt/><dd/> paradigm because of the difficulty I had
applying CSS.
Now this doesn't answer your question but does show how I solved the
problem of having to style <dt> and <dd> tags and keep them related: I
wrap each <dt/><dd/> in a <dl></dl> which keeps the label and form
element together and only requires positioning one element: the <dl/>.
Here's my method.
public function setFormDecorators(Zend_Form $form)
{
$form->setDecorators(array(
array('FormElements', array(
'separator' => "</dl>\n<dl>"
)),
array('myDtDdWrapper' => 'DtDdWrapper'),
array(
array('myHtmlTag' => 'HtmlTag'),
array('tag' => 'dl')
),
'Fieldset',
'DtDdWrapper',
array('HtmlTag', array(
'tag' => 'dl',
'class' => 'zend_form'
)),
'Form'
));
return;label {
}
This was a cut from a vi edit session and copied here. I hope I didn't
introduce any errors when I did that.
To further complete the illusion that the labels and form elements are
atomic the label is positioned *over* and *within* the form input
elements. Here's my CSS.
body {position: relative;}
input,
label {
position: relative;
display: block;
}
label {
z-index: 2;
top: 8pt;
left: 4pt;
font-family: sans-serif;
font-size: 5pt;
font-weight: bold;
}
input {
padding: 7pt 0 0 7pt;
font-size: 10pt;
}
Since I figured that out I haven't looked back. Hope it is a solution
that works for you.
Mike Wright