Reputation: 617
I am developing a zendframework project. My sign up page contains a field "I Agree to the Terms of Use" with a check box near to it. Here I want to make "Terms of use” as a link. But I am new to the zend and PHP5. I checked the code and below is the code to display "I Agree to the Terms of Use"
'Agree' => array ('Checkbox', array (
'Required' => true,
'Decorators' => $element Decorators,
'Label' => 'I Agree to the Terms of Use',
)),
How I would make Terms of Use as a link?
Upvotes: 0
Views: 1363
Reputation: 5315
You can also do it the following way:
$radioElement = new Zend_Form_Element_Checkbox('formelement_0');
$radioElement->setLabel('Do you accept the <a href="#">Terms & Conditions</a>?');
$radioElement->getDecorator('Label')->setOption('escape', false);
Upvotes: 1
Reputation: 2158
You can add HTML to the label if you have your label decorator set up correctly. First, add 'escape' => false
to the options of your label decorator. Without seeing your exact decorators it is difficult to say exactly how it should look for you, but it is likely to look like this:
$elementDecorators = array(
// some decorators...
array('Label',
array('placement' => 'prepend',
'escape' => false)),
// other decorators...
);
Then, add the HTML anchor to your label:
'Label' => 'I Agree to the <a href="/terms-of-use/">Terms of Use</a>',
Be wary of placing links on labels though. A label's native click action is to bring focus to the input it is associated with. If you have problems with this, you can apply the same options to a Description
decorator and add the link there.
Upvotes: 4
Reputation: 4343
I dont know anything about this Framework, just guessing...
'Label' => 'I Agree to the <a href="/terms.pdf">Terms of Use</a>',
Upvotes: -2