John Smith
John Smith

Reputation: 6269

How to hide submit_tag button

I have an simple form:

<%= form_tag icd_test_path, :method => 'get', remote: true do %>
<%= hidden_field_tag(:sicherheit) %>
<%= hidden_field_tag(:id) %>
<%= submit_tag "", :id => 'Scomit' %>
<% end %>

How you can see both text_fields are hidden, now search an way to hide the submit_tag as well?It want the form hidden because its only triggerd by jquery!

Upvotes: 4

Views: 8344

Answers (2)

mnishiguchi
mnishiguchi

Reputation: 2241

I prefer writing raw HTML in this type situation. It is a lot cleaner.

<input type="submit" id="Scomit" style="display:none">

Upvotes: 0

kristenmills
kristenmills

Reputation: 1297

Adding display none to the submit tag should do the trick.

<%= form_tag icd_test_path, :method => 'get', remote: true do %>
<%= hidden_field_tag(:sicherheit) %>
<%= hidden_field_tag(:id) %>
<%= submit_tag "", :id => 'Scomit', :style => "display: none;" %>
<% end %>

Upvotes: 10

Related Questions