Add html element inside of form element using cake php form helper

假如想象 提交于 2019-12-06 08:06:35

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

Please try below code.

echo $this->Form->button('Search', array('type' => 'submit','id' => 'search_button','class' => 'searchbutton','escape' => true,
        'after' => "<i class='icon-search'></i>"));
Naresh Kumar

see this

echo $this->Form->button('Search', array('type' => 'submit','id' => 'search_button','class' => 'searchbutton','escape' => true, 'after' => "<i class='icon-search'></i>"));

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!