Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding links to simple_form hints?

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: "[email protected]"                             
    =f.input :password, hint: { link_to "Forgot your password?", new_password_path(resource_name) }
like image 525
Genís Avatar asked Feb 13 '13 09:02

Genís


1 Answers

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.

like image 190
Peter de Ridder Avatar answered Nov 04 '22 17:11

Peter de Ridder