Reputation: 295
Hello All,
I'm looking for someone who can tell me how to set a label to an element created by createElement() method in zend form.
I want to create an array of input elements with label.
Thanks In Adv.
Upvotes: 4
Views: 505
Reputation: 7485
In ZF1, If an element has already been created and added to a form and you want to change the label later. Grab the element and use the setLabel method on it:
<?php
$myForm->getElement('lastName')->setLabel('Surname');
?>
Upvotes: 0
Reputation: 14184
...how to set a label to an element created by createElement() method in zend form
$form->createElement('text', 'someElement', array(
'label' => 'Some label',
));
Upvotes: 2