Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8644689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:21:39+00:00 2026-06-12T12:21:39+00:00

I have a standard rails form_for tag for creating and editing a new hotel.

  • 0

I have a standard rails form_for tag for creating and editing a new hotel. This renders just fine when visited via the edit_hotels_path, however when visting the new_hotels_path the html form tag is being set to display: none; causing the form to not show only in the “new” view.

I have restarted the server, emptied the cache, made sure they are using the same CSS but it still renders with display set to none.
Here are the styles as seen using developer tools

<form accept-charset="UTF-8" action="/hotels" class="new_hotel" id="new_hotel" method="post" style="display: none; "><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="pDlR3gV2tm+Z7xRFdC0uclNY13FlzxUSOjOrHs2ttO0="></div>

element.style {
display: none;
}

below is the html source being rendered, which doesn’t include display: none;

    <form accept-charset="UTF-8" action="/hotels" class="new_hotel" id="new_hotel" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="pDlR3gV2tm+Z7xRFdC0uclNY13FlzxUSOjOrHs2ttO0=" /></div>

  <div class="control-group">
    <div class="controls">
    <input id="hotel_name" name="hotel[name]" placeholder="Name..." size="30" type="text" /><br>
        <select id="hotel_year" name="hotel[year]"><option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option></select><br>
        <select id="hotel_month" name="hotel[month]"><option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option></select><br>

    <textarea cols="40" id="hotel_body" name="hotel[body]" placeholder="Hotel info up to 1000 words..." rows="20">
</textarea><br>
    <input id="hotel_meta_tags" name="hotel[meta_tags]" placeholder="Enter meta tags for image, as a comma separated list..." size="30" type="text" /><br>
<legend>Winner</legend>
        <input name="hotel[winner]" type="hidden" value="0" /><input id="hotel_winner" name="hotel[winner]" type="checkbox" value="1" />
        <br/>

    </div>
<div class="form-actions">
    <input class="btn-large btn-success" name="commit" type="submit" value="create" />
  </div>
</div>
</form>

below is the code, would appreciated any help.

_form.html.erb

<%= form_for @hotel do |f| %>
<% if @hotel.errors.any? %>
  <div id="error_explanation">
    <h2><%= pluralize(@hotel.errors.count, "error") %> prohibited this article from being saved:</h2>

    <ul>
    <% @hotel.errors.full_messages.each do |msg| %>
      <li><%= msg %></li>
    <% end %>
    </ul>
  </div>
<% end %>


    <%= render partial: "shared/code_sheet" %>
  <div class="control-group">
    <div class="controls">
    <%= f.text_field :name, placeholder: "Name..." %><br>
        <%= f.select :year, [2012, 2013, 2014, 2015] %><br>
        <%= f.select :month, ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] %><br>

    <%= f.text_area :body, placeholder: "Hotel info up to 1000 words..." %><br>
    <%= f.text_field :meta_tags, placeholder: "Enter meta tags for image, as a comma separated list..." %><br>
<legend>Winner</legend>
        <%= f.check_box :winner %>
        <br/>

    </div>
<div class="form-actions">
    <%= f.submit "create", class: "btn-large btn-success" %>
  </div>
</div>
<% end %>

edit.html.erb

<div class="container">
<h1>Editing hotel</h1>

<%= render "form" %>
<%= link_to 'hotels index', hotels_path %>
</div>

new.html.erb

<div class="container">
<h1>New hotel</h1>

<%= render "form" %>
<%= link_to 'hotels index', hotels_path %>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:21:41+00:00Added an answer on June 12, 2026 at 12:21 pm

    It could be anything. You must know what is in your CSS. Did you search for ‘display: none;’ in your CSS files and checked the matches? element.style is usually set directly on the HTML tag. Search the view also place debugging string to make sure it is pulling the appropriate .html.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pretty standard Rails form: <div> <h1>Create a New Listing</h1> <%- form_for
I'm creating a Ruby (not Rails) script and I have to test using standard
In a standard Rails controller, I'd create a record like this: @user = User.new(params[:user])
I followed this tutorial to send emails from rails and it works just fine.
In Rails 3.0 I have the standard 'new' form that creates a new record,
Given that I have a Foo model w/ the standard Rails timestamp columns what
I have a rails application where I store created_at as datetime (standard). I am
I'm using the standard Rails I18n API to localise some of our views. This
I have a very standard CRUD app in Rails & Jquery Mobile with two
I have a rails project running that defines the standard production:, :development and :test

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.