heartcombo / simple_form

Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup.
http://blog.plataformatec.com.br/tag/simple_form
MIT License
8.21k stars 1.31k forks source link

simple_form generate two input box. #1844

Closed acekingke closed 2 months ago

acekingke commented 2 months ago

Precheck

Environment

Current behavior

Include code samples, errors, steps to reproduce the error and stacktraces if appropriate.

Will be even more helpful if you provide a sample application or a test case that reproduces the error.


<%= simple_form_for quote, html: { class: "quote form" } do |f| %>
  <% if quote.errors.any? %>
    <div class="error-message">
      <%= quote.errors.full_messages.to_sentence.capitalize %>
    </div>
  <% end %>
  <%= f.input :name, input_html: { autofocus: true } %>
  <%= f.submit class: "btn btn--secondary" %>
<% end %>

But it generator 2 input boxes image

<form class="simple_form quote form" id="edit_quote_1" novalidate="novalidate" action="/quotes/1" accept-charset="UTF-8" method="post"><input type="hidden" name="_method" value="patch" autocomplete="off"><input type="hidden" name="authenticity_token" value="JU9dKSU4AFAyBH9ZdQUmA5830r5EH_Q4uqsoA5_f80hzVpo3uNkHD5qfgeyfdh1x72roLTc6au61_TyPBN5l4A" autocomplete="off">
  <div class="input field_without_errors"><label class="visually-hidden" for="quote_name">Name</label><input class="form__input" autofocus="autofocus" placeholder="Name of your quote" type="text" value="aggg" name="quote[name]" id="quote_name"><label for="quote_name">Name</label><input autofocus="autofocus" placeholder="Name of your quote" type="text" value="aggg" name="quote[name]" id="quote_name"></div>
  <input type="submit" name="commit" value="Update quote" class="btn btn--secondary" data-disable-with="Update quote">
</form>

Expected behavior

I want just one input box

nashby commented 2 months ago

@acekingke hey! I tried to reproduce it in a newly created app, but it works as expected, so I assume there's something wrong with your setup. Unless you provide a sample app, we can't do much. I'm closing this for now, but feel free to upload a sample app that reproduces the issue.