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

41 views
Skip to first unread message

scottc

unread,
Dec 11, 2012, 7:12:47 PM12/11/12
to rubyonra...@googlegroups.com

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.

Walter Lee Davis

unread,
Dec 11, 2012, 9:47:39 PM12/11/12
to rubyonra...@googlegroups.com

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

Jim Ruther Nill

unread,
Dec 11, 2012, 9:52:12 PM12/11/12
to rubyonra...@googlegroups.com
Looking at the api, I think it's possible to pass a block for a nested label tag

 

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.



--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com
Reply all
Reply to author
Forward
0 new messages