Nico
Nico

Reputation: 170

Zend_Form_Multicheckbox multiOptions with HTML in it

For my form I need a checkbox with a single options "I accept the eligibility requirements", where "eligibility requirements" should be linked to a popup with the eligibility requirements in it.

This is my current code:

$teilnahmebedingungenArray = array('akzeptiere' => "Ich akzeptiere die <a href='foo.html'>Teilnahmebedingungen</a>");    

new Zend_Form_Element_Multicheckbox(
                    'teilnahmebedingungen', 
                    array(
                        'required' => true,
                        'label' => null,
                        'multiOptions' => $teilnahmebedingungenArray,
                        'registerInArrayValidator' => false,
                        'filters' => array('StringTrim'),
                        'validators' => array(
                            array('NotEmpty', false, array('messages' => 'Sie müssen die Teilnahmebedingungen akzeptieren um am Wettbewerb teilzunehmen.'))
                        ),
                        'decorators' => $this->getQuestionDecorators(),
                    )
                ),

Zend_Form_Multicheckbox doesn't allow me to use HTML code in it's multioption. Is there an easy way to allow it or would you choose another way to solve the case? I don't want to set the eligibility requirements as a description.

Best regards, Nico

Upvotes: 2

Views: 1885

Answers (1)

Marcin
Marcin

Reputation: 238239

Adding'escape' => false option should do the trick, e.g.

new Zend_Form_Element_MultiCheckbox(
                    'teilnahmebedingungen', 
                    array(
                        'required' => true,
                        'label' => null,
                        'escape' => false
                         // the rest 

Upvotes: 3

Related Questions