Closed clawfire closed 12 years ago
You need to make a Button element and make it of the type 'submit'
<?php
// Inside the form init
$this->addElement('button', 'mySubmitName', array(
'label' => 'Save',
'icon' => 'plus-sign',
'whiteIcon' => true,
'type' => 'submit'
));
That will get you a submit button with the icon
Exactly. As @lrobert points out with his example code, in order to get a button with a small icon inside you need to use a Twitter_Bootstrap_Form_Element_Button
.
I'll test that, it's make the type="submit" ok but place the <i class="icon-plus-sign"></i>
into the value attribut, so it's passed with the form ...
'ok but place the into the value attribut'
Place what into the value attribute?
<i class="icon-plus-sign"></i>
You can add that directly into the value by using
// Inside the form init
$this->addElement('button', 'mySubmitName', array(
'label' => 'Save',
'icon' => 'plus-sign',
'whiteIcon' => true,
'type' => 'submit',
'value' => 'Whatever you want here'
));
But I must ask, why would you want that posted?
I don't want it, <i class="icon-plus-sign"></i>
is automatically inserted into value=""
because it's the label of the button :(
Funny thing, I just ran into this! It doesn't even create the value properly :/
I'll open a new ticket describing the issue and I'll work on a fix.
@lrobert thx you
Twitter_Bootstrap_Form_Element_Submit
didn't support icons butTwitter_Bootstrap_Form_Element_Button
did. Also we can't make a Button typesubmit
without getting the icon as avalue
in the generated code , resulting it passed as an element in the post / get call .