Forum: Ruby on Rails Adding a hyperlink to a pop-up window on a form field label in Rails

Posted by scottc (Guest)
on 2012-12-12 01:14
(Received via mailing list)
Is there a way to embed a hyperlink in a form label in Rails using 
link_to?

I am trying to do this in a form field as follows:

<%= f.label "Accept Terms of Service?" %>

I appreciate any ideas.
Posted by Walter Davis (walterdavis)
on 2012-12-12 03:49
(Received via mailing list)
On Dec 11, 2012, at 7:12 PM, scottc wrote:

> Is there a way to embed a hyperlink in a form label in Rails using link_to?
>
> I am trying to do this in a form field as follows:
>
> <%= f.label "Accept Terms of Service?" %>

Try this:

<%= f.label("#{link_to('Accept Terms of Service', 
'/terms_of_service.html')}".html_safe) %>

Walter
Posted by Jim ruther Nill (jimboker)
on 2012-12-12 03:53
(Received via mailing list)
On Wed, Dec 12, 2012 at 10:47 AM, Walter Lee Davis 
<waltd@wdstudio.com>wrote:

> Try this:
>
> <%= f.label("#{link_to('Accept Terms of Service',
> '/terms_of_service.html')}".html_safe) %>
>

Looking at the api, I think it's possible to pass a block for a nested
label tag

http://api.rubyonrails.org/classes/ActionView/Help...


>
>
>


--
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.