Submit button does not work unless I refresh the page form_for Rails

后端 未结 2 1257
遇见更好的自我
遇见更好的自我 2021-01-04 05:07

I have an app that has a problem model and when I go to create a record the submit button does nothing. No errors given it just simply doesnt execute, unless I refresh the p

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-04 05:52

    Your HTML is invalid, the submit button is actually not nested under the form tag. Try changing your view code to this:

    <%= form_for @problem do |f| %> <%= f.text_field :name, placeholder: "Name your problem!" %>
    <%= f.text_field :url, placeholder: "Link to any supporting material" %>
    <%= f.text_area :description %>
    <%= f.submit "Create" %>
    <% end %>

提交回复
热议问题