2

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?

3 Answers 3

2
$field->setAttrib('class', 'btn')->setLabel('Save');

please note the capital 'L' in setLabel() above

Sign up to request clarification or add additional context in comments.

3 Comments

Hi rishi, i tried this code ->setLabel('Save') but its still not showing the value in the submit.
Both setlabel and setLabel work, I've tested them (using your code) and they do. How do you display your form or this form input ?
My output does not get the 'helper="formSubmit"' bit, where does that come from ?
1

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'
));

Comments

0

You want to set the value? so use the setter:$field->setValue('Save');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.