# Embedding links in text fields

**URL:** <https://www.ruby-forum.com/t/embedding-links-in-text-fields/88438>\
**Category:** Rails\
**Created:** [March 11, 2007, 2:12am UTC](https://www.ruby-forum.com/t/embedding-links-in-text-fields/88438 "2007-03-11T02:12:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a87d85/32.png) [@vin](https://www.ruby-forum.com/u/vin)\
**Post date:** [March 11, 2007, 2:12am UTC](https://www.ruby-forum.com/t/embedding-links-in-text-fields/88438/1 "2007-03-11T02:12:10Z")

</div>

I am trying to buld a link with text displayed within a text\_field or  
text\_field\_tag. e.g. the following text field displays an ID of 1.

```
<%= text_field_tag(@contact, @contact.id , {:readonly => true}) %>

```

I would like the 1 to also be a hyper link to allow me open and show  
contact.

Effectively I am trying to do something like

```
<%= text_field_tag(@contact, <%= link_to @contact.id, :action =>

```

‘show\_contact’, :id =\> @contact.id %\> , {:readonly =\> true}) %\>

---

<div class="post-metadata">

**Author:** ![vin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a87d85/32.png) [@vin](https://www.ruby-forum.com/u/vin)\
**Post date:** [March 11, 2007, 10:37am UTC](https://www.ruby-forum.com/t/embedding-links-in-text-fields/88438/2 "2007-03-11T10:37:18Z")

</div>

On Mar 11, 2007, at 2:12 AM, vin wrote:

> ```
> <%= text_field_tag(@contact, <%= link_to @contact.id, :action =>
> 
> ```
> 
> ‘show\_contact’, :id =\> @contact.id %\> , {:readonly =\> true}) %\>

I don’t think you can do that. Browsers “strip” most markup from text  
field contents.

– fxn
