It would appear Zend_Form is htmlentitizing (is that a word?) the labels for
my elements. Why? How do I disable it? I especially need it on checkbox
labels, as it's a list of check boxes with HTML data (in my case, each
checkbox has its own headline and description) associated with each box.
My code is:
------------
foreach ( $list as $id => $optin ) {
$values[$id] = sprintf( '<strong class="optin_headline">%s</strong><br
/><p class="optin_desc">%s</p>', $optin['Headline'], $optin['Description']
);
}
$field = $this->getElement( 'optins' );
$field->setMultiOptions( $values );
----------------
And my output is:
-----
<label for="optins-1003"><input type="checkbox" name="optins[]" id="
optins-1003" value="1003" /><strong class="optin_headline">P
TODO</strong><br /><p
class="optin_desc">TODO</p></label><br /><label for="
optins-1005"><input type="checkbox" name="optins[]" id="optins-1005" value="
1005" /><strong class="optin_headline">D
TODO</strong><br /><p
class="optin_desc">TODO</p></label><br /><label for="
optins-1061"><input type="checkbox" name="optins[]" id="optins-1061" value="
1061" /><strong class="optin_headline">A
TODO</strong><br /><p
class="optin_desc">TODO</p></label><br /><label for="
optins-1066"><input type="checkbox" name="optins[]" id="optins-1066" value="
1066" /><strong class="optin_headline">P
TODO</strong><br /><p
class="optin_desc">TODO</p></label><br /><label for="
optins-1011"><input type="checkbox" name="optins[]" id="optins-1011" value="
1011" /><strong class="optin_headline">P
TODO</strong><br /><p
class="optin_desc">TODO</p></label>
--------------------------
A complete mess! Every bracket is htmlentitized. While I don't understand
the reasoning as to why, I need to find a way to disable it. It's quite
common practice to use html content in checkbox element labels. Why
htmlentities the labels?
The HTML I expected was (label and checkbox not shown):
---
<strong class="optin_headline">P TODO</strong><br /><p
class="optin_desc">TODO</p>
<strong class="optin_headline">D TODO</strong><br /><p
class="optin_desc">TODO</p>
<strong class="optin_headline">A TODO</strong><br /><p
class="optin_desc">TODO</p>
<strong class="optin_headline">P TODO</strong><br /><p
class="optin_desc">TODO</p>
<strong class="optin_headline">P TODO</strong><br /><p
class="optin_desc">TODO</p>
------------------
Thanks
---
Philip
[email protected]
http://www.gpcentre.net/