-1

i am using the simple form gem and the inputs labels shows an Asterisk " * " before text and i do not need that

something like: *Year *Month *Week *Quantity

simple form view:

<%= simple_form_for @tech_evaluation do |f| %>
<%= f.input :year, label: "Año", collection: 2017..2020 %>

<%= f.association :project, label: "Proyecto" %>
<%= f.association :countable_account, label: "Cuenta contable" %>
<%= f.association :item %>
<%= f.input :unit_cost, label: "Costo unidario" %>
<%= f.input :unit, label: "Unidad de medida", collection: [ "C/U" ] %>
Finn
  • 1,510
  • 13
  • 22

1 Answers1

1

This is a possible duplicate of How to disable asterisk on form's required fields?

If you want to disable asterisks for that form only, pass defaults: { required: false } into simple_form_for:

<%= simple_form_for(@tech_evaluation, defaults: { required: false }) do |f| %>
# ...

Or you can disable it even for just a single input element:

<%= f.input :year, label: "Año", collection: 2017..2020, required: false %>

Read more at Simple Form: Usage

Lastly, if you want to disable the asterisk mark for ALL simple forms, you can do so by creating the file simple_form.en.yml under config/locales/ with this content:

# config/locales/simple_form.en.yml
en:
  simple_form:
    required:
      text: 'required'
      mark: '*'
      # This will overwrite required text and mark for all simple forms.
      # When using html, text and mark won't be used.
      # Comment out the line below to return to default settings.
      html: ''

See more configuration options at simple_form.en.yml on Gituhb

Finn
  • 1,510
  • 13
  • 22