Why is my button not appearing on the page?

Issue

I have this form in a partial:

<%= form_for current_user.relationships.build(:followed_id => @profile.user.id) do |f| %>
  <div><%= f.hidden_field :followed_id %></div>
  <div class="follow_button"><%= f.submit "Follow" %></div>
<% end %>

that is rendered to my profile view. Here is the resulting html:

<form accept-charset="UTF-8" action="/relationships" class="new_relationship" id="new_relationship" method="post">
    <div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓">
    <input name="authenticity_token" type="hidden" value="fo9dve4XjKpqSHqkmYw/lsEPm4PUxRYy+5JM5D4aTLg="></div>
    <div><input id="relationship_followed_id" name="relationship[followed_id]" type="hidden" value="58"></div>
    <div class="follow_button"><input id="relationship_submit" name="commit" type="submit" value="Follow"></div>
</form>

The form is there, and the css display attribute for the button is not hidden, so why is the button not appearing?

Solution

Perhaps something else in your CSS file is causing the submit button to be hidden. Try disabling your CSS styles for the entire page and see if the button is still hidden.

Answered By – Kyle Decot

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published