Reputation: 31
Hi I have a zend form with this code in it
$field = new Zend_Form_Element_Submit('submit');
$field->setAttrib('class', 'btn')->setlabel('Save');
$this->addElement($field);
but the html comeing is:
<input type="submit" class="btn" helper="formSubmit" value="" id="submit" name="submit">
can't figure out why is the value not showing up?
Upvotes: 2
Views: 1576
Reputation: 691
You want to set the value? so use the setter:$field->setValue('Save');
Upvotes: 0
Reputation: 11
Change type (default type="button" don't trigger form submit) to "submit". e.g.
$this->addElement('button', 'my_button', array(
'label' => 'Click me',
'class' => 'nice_button',
'type' => 'submit'
));
Upvotes: 1
Reputation: 3950
$field->setAttrib('class', 'btn')->setLabel('Save');
please note the capital 'L' in setLabel()
above
Upvotes: 2