Question

On this edit page screen I've set up a "Current Password" field required to edit the user information (to change my name for example) but for some reason that particular current password field is not showing up while all the other input fields do.

I can't figure out why its not showing up?

Thank you!

<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { :method => :put, class: 'form-horizontal'}) do |f| %>
  <%= f.error_notification %>

  <%= f.input :name, :label => "Nombre" %>
  <%= f.input :email, :label => "Correo Electronico" %>
  <%= f.input :password, :label => "Nueva Contraseña", autocomplete: "off" %>
  **<%= f.input :password_confirmation, :label => 'Confirmar Contraseña', autocomplete: "off" %>**
  <% f.input :current_password, :label => "Contraseña Actual" %>

    </br>

  <div class= "form-actions">
  <%= f.submit "Actualizar Datos", class: "btn btn-primary"%>
  </div>
  <% end %>
Was it helpful?

Solution

You forgot to add the = in the ERB tab. It won't echo to the page without that. It should look like this:

<%= f.input :current_password, :label => "Contraseña Actual" %>

Keep in mind, statements whose values you do not want to show on the page should omit the equals (=) sign. Examples of those statements would be things like <% if ... %>, <% @some_var.each do .... %> etc.

Values you do wish to appear on the page, such as your input line, should have the equals sign.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top