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 element开发者_高级运维s with label.
Thanks In Adv.
...how to set a label to an element created by createElement() method in zend form
$form->createElement('text', 'someElement', array(
'label' => 'Some label',
));
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');
?>
精彩评论