Pergunta

Is there a way to have a link inside a hint from an specific input within a simple_form form?

For example- "Forgot your password?" in passwords' input hint.

This way some styling could be avoided to attach the link to the input box.

May be a stupid question but I can't figure out how to do it :/

Thanks in advance.

Edit (This syntax is wrong, but hope it gives the idea on what I am trying to say, specifically in line 3):

=simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
    =f.input :email, placeholder: "me@example.com"                             
    =f.input :password, hint: { link_to "Forgot your password?", new_password_path(resource_name) }
Foi útil?

Solução

All you need is interpolation.

<%= f.input :password, hint: "#{link_to 'Forgot your password?', new_password_path(resource_name)}" %>

This will insert your code within the hint. In this case a forgotten password link.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top