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

Chrome rendering of forms and associated JS #1707

Closed liberom closed 3 years ago

liberom commented 4 years ago

Precheck

I have encountered an issue with the form rendering in Chrome. I usually work with Firefox and I hadn't experience any problems, but I tried testing the webapp in Chrome and the form is not properly formatted and some JS is not working. I've searched the issues here and didn't find any similar problems. I have also searched online for explanations and haven't found a thing. I would appreciate the input of more experienced coders.

Environment

Versions Ruby: 2.6.5p114 Rails: 6.0.1 Simple Form: 5.0

Current Behavior

image Form rendered by Chrome The two main lines of this form should all be on the same line, the fields sizes are, in general, 8. The read-only fields in grey should show values fetched by the JS.

Expected behavior

image Form rendered by Firefox

Form Code

I can provide the complete html and/or the JS as well if necessary.

`<%= simple_form_for([@operation, @movement]) do |f| %>

<%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>

<%= f.button :submit, "Salvar", class:"btn btn-w-m btn-primary" %>
<%= link_to 'Cancelar', operation_path(@operation), class:"btn btn-w-m btn-success" %>

<%= f.simple_fields_for :mov_date do |d| %>
  <%= d.input :date, label:"Data", input_html: { type:"date", class:"form-control", id:"movement-date" } %>
<% end %>

<%= f.input :date, as: :hidden, required: false, input_html: { class:"form-control", id:"call-sell-date" } %>
<%= f.input :buy_sell, required: false, label:"C / V", input_html: { type:"text", class:"form-control", readonly: :true, value: "Venda", maxlength: 8, size: 8 } %>
<%= f.input :asset_type, as: :hidden, required: false, input_html: { class:"form-control", value: 'Option', readonly: :true } %>
<%= f.input :asset, required: true, label: "Ativo", input_html: { class:"form-control", maxlength: 10, size: 10, id:"call-sell-code" } %>
<%= f.input :quantity, required: true, label:"Quantidade", input_html: { class:"form-control text-right", maxlength: 8, size: 8, id:"call-sell-quantity" } %>
<%= f.input :price, required: true, label:"Preço", input_html: { class:"form-control text-right", maxlength: 8, size: 8, id:"call-sell-price", oninput:"calcTaxes();" } %>
<%= f.input :exercise_price, required: true, label:"P.E.", input_html: { class:"form-control text-right", maxlength: 8, size: 8, id:"call-sell-pe" } %>
<%= f.input :brokerage_cost, required: false, label:"Corretagem", input_html: { class:"form-control text-right", readonly: :true, maxlength: 8, size: 8, id:"call-sell-brokerage" } %>
<%= f.input :tax_cost, required: false, label:"Taxas", input_html: { class:"form-control text-right", readonly: :true, maxlength: 8, size: 8, id:"call-sell-tax" } %>
<%= f.input :issqn_cost, required: false, label:"ISSQN", input_html: { class:"form-control text-right", readonly: :true, maxlength: 8, size: 8, id:"call-sell-issqn" } %>
<%= f.input :other_cost, required: false, label:"Outros", input_html: { class:"form-control text-right", readonly: :true, maxlength: 8, size: 8, required: :false, id:"call-sell-others" } %>

<%= f.input :exercise_value, as: :hidden, label: false, input_html: { class:"form-control", maxlength: 8, size: 8, value: 0 } %>

<%= f.input :broker_table_fee, label:"Corret. Mesa (%)", input_html: { class:"form-control", maxlength: 8, size: 8, id:'broker-table-fee' } %>
<%= f.input :broker_table_cost, required: false, label:"Corret. Mesa (R$)", input_html: { class:"form-control", maxlength: 8, size: 8 } %>

<% end %>`

feliperenan commented 3 years ago

I wouldn't say this is a simple form issue since we don't control/interpolate any JS. Could you try to reproduce this issue on an isolated app? If you still see the same issue, please send the link to us so we can try to figure out what is happening.

Thanks