anurodh
anurodh

Reputation: 295

set lable to elements created by createElement method in zend framework

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

Answers (2)

Progrock
Progrock

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

David Weinraub
David Weinraub

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

Related Questions