4

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!

John Smith
  • 6,105
  • 16
  • 58
  • 109

2 Answers2

10

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 %>
kristenmills
  • 1,227
  • 10
  • 14
  • [This answer](http://stackoverflow.com/questions/477691/submitting-a-form-by-pressing-enter-without-a-submit-button) seems to indicate style="visibility: hidden;" is more cross-browser friendly. – brntsllvn Mar 06 '16 at 01:06
0

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

<input type="submit" id="Scomit" style="display:none">
mnishiguchi
  • 2,051
  • 23
  • 17