Questions
I am trying to create a simple html output that looks like this
<button class="searchbutton" id="search_button" type="submit">-->
<i class="icon-search"></i> Search</button>
with Cake php s form helper, i cant figure out why the after attribute doesn t add the inner <i> </i> html element.
This is what i have tried.
echo $this->Form->button( Search , array( type => submit , id => search_button , class => searchbutton ,
after => "<i class= icon-search ></i>"));
Answers
You just include the extra <i></i> tag in the button $title, also include escape => false to ensure the mark up is not escaped, even though is not escaped by default as on v3.1.1, this may change in future, who knows..
Example:
echo $this->Form->button("<i class= icon-search ></i> Search", array( type => submit , id => search_button , class => searchbutton , escape => false));
Source
License : cc by-sa 3.0
http://stackoverflow.com/questions/14016966/add-html-element-inside-of-form-element-using-cake-php-form-helper
Related