We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to add an image to button in volt

i want to add a glyphicon icon to submit_button in volt...i had tried something like this.....Can someone help? {{ submit_button("Edit<i class='glyphicon glyphicon-pencil'></i> ", "class": "btn btn-info btn-lg") }}



59.9k
Accepted
answer
edited Dec '16

Hi,

something like this will do the trick:

                {{ tag_html("button", ["type":"submit","class": "btn btn-primary"]) }}
                Edit <i class='glyphicon glyphicon-pencil'></i>
                {{ tag_html_close("button") }}

thanks a lot!!! Can you please help in one more thing..... I want both text_field and button_field side by side......how i do this?

                        {{ text_field('search_criteria', 'class': "search-control",'placeholder':"Location,Department,Band....or Employee ID") }}
    {{ tag_html("button", ["type":"submit","class": "btn btn-primary"]) }}
    <i class='glyphicon glyphicon-search'></i>
    {{ tag_html_close("button") }}


59.9k

Always the same:

        {{ tag_html("textarea", ["cols":"30","row": "4","class":"form-control","placeholder":"Send"]) }}

        {{ tag_html_close("textarea") }}

Do you mean a button-group in bootstrap?

https://getbootstrap.com/components/#btn-groups

Or input-group?

https://getbootstrap.com/components/#input-groups