Deepak saini
Deepak saini

Reputation: 4270

how to make hyperlink to label in zf2

I want to make a hyperlink of label in zend form. I agree to the Terms and Privacy policy make terms and condition to be link.

My code is:-

$this->add(array(
            'type' => 'Checkbox',
            'name' => 'agreeterms',
            'options' => array(
                'label' => 'I agree to the <a href="http:google.com">Terms and Privacy policy</a>',
                'use_hidden_element' => true,
                'checked_value' => 1,
                'unchecked_value' => 'no',
                'id'=>'term_and_condition',
            ),
        ));

Upvotes: 1

Views: 112

Answers (1)

KiwiJuicer
KiwiJuicer

Reputation: 1982

You can split label and input field in the view:

$this->formLabel($this->form->get('agreeterms'));
$this->formText($this->form->get('agreeterms'));

Then you can wrap the <a href="..."> ... </a> around it.

Upvotes: 2

Related Questions