ruby on rails - HTML content for button_to -


i using link_to:

<%= link_to edit_webcast_path(@webcast), :class => 'btn'  %>     <i class="icon-pencil"></i> edit webcast <% end %> 

but want same button_to, button_to must have first label argument passed or use path label.

<%= button_to edit_webcast_path(@webcast), :class => 'btn'  %>     <i class="icon-pencil"></i> edit webcast <% end %> 

... results in button label resolved edit_webcast_path(@webcast) path. in effect seems have no effect.

i have tried passing html directly first argument:

<%= button_to "<i class=\"icon-white icon-minus-sign \"></i> edit webcast".html_safe, webcast_path(@webcast), :class => 'btn'%> 

but results in button label displaying part of html string pass in. looking @ generated html can see contents of first argument placed in input's value attribute , not inside input itself.

how can work?

rails button_to generates form html <input type="submit"> element , not <button> one. can try override or write own helper generate <button> , take look @ example


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -