Aniee
Aniee

Reputation: 81

submit_tag is not working with correct css in rails4 view

Hi I have to give following view in my rails code

<div class="col s12 m2"> 
   <button class="btn waves-effect waves-light btn-medium custom_btn_gray right margin_T20" type="submit" name="action">Search  
  </button>
</div>

So for this I had included following rails view code :

<div class='col s12 m2'>
   <%= submit_tag('search', class: 'btn waves-effect waves-light btn-medium custom_btn_gray right margin_T20')%>
</div>

which further gives this type of html:

<div class="col s12 m2">
            <i class="btn waves-effect waves-light btn-medium custom_btn_gray right margin_T20 waves-input-wrapper" style=""><input type="submit" class="waves-button-input" value="search" name="commit"></i>
  </div>

But I dont want this I want like the above html . Please guide me where am going wrong . Thanks in advance.

Upvotes: 1

Views: 89

Answers (3)

Peace
Peace

Reputation: 626

Then try this using button_tag

<%= button_tag(type: 'submit', class: "btn waves-effect waves-light btn-medium custom_btn_gray right margin_T20") do %> Search
<% end %>

Upvotes: 0

Peace
Peace

Reputation: 626

Try this :

<div class='col s12 m2'>
 <%= submit_tag "Search", :class => "btn waves-effect waves-light btn-medium custom_btn_gray right margin_T20" %>
</div>

Upvotes: 0

ciaoben
ciaoben

Reputation: 3338

You need to use the button_tag:

<%= button_tag('search', class: 'btn waves-effect waves-light btn-medium custom_btn_gray right margin_T20')%>

Here is the doc

Upvotes: 3

Related Questions