# Formatting text in view mode same as edit mode

**URL:** <https://www.ruby-forum.com/t/formatting-text-in-view-mode-same-as-edit-mode/156733>\
**Category:** Rails\
**Created:** [January 2, 2009, 6:05am UTC](https://www.ruby-forum.com/t/formatting-text-in-view-mode-same-as-edit-mode/156733 "2009-01-02T06:05:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [January 2, 2009, 6:05am UTC](https://www.ruby-forum.com/t/formatting-text-in-view-mode-same-as-edit-mode/156733/1 "2009-01-02T06:05:20Z")

</div>

Hi  
I have a text are in my edit form as below  
\<%= text\_area “sd\_ticket”, “description”, “cols” =\> 80, “rows” =\> 5 %\>

```
And here i am entering some text with spaces and enter keys ..Now

```

suppose if it has some 4 paragraphs My problem is when i try to view the  
same data in view mode it is not formatted as i gave rather it shows  
like its own style I dont get as much enter keys (pargraphs) as I gave  
mainly. I used view code like

\<%=h @sd\_ticket.description %\>

```
 What might be the reason.Please help. I tried the above without h

```

method ie

\<%=h @sd\_ticket.description %\> then also no difference

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [January 2, 2009, 6:59am UTC](https://www.ruby-forum.com/t/formatting-text-in-view-mode-same-as-edit-mode/156733/2 "2009-01-02T06:59:17Z")

</div>

> \<%= text\_area “sd\_ticket”, “description”, “cols” =\> 80, “rows” =\> 5 %\>
> 
> ```
> And here i am entering some text with spaces and enter keys ..Now
> 
> ```

```
<%=h @sd_ticket.description %>
```

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [January 2, 2009, 7:16am UTC](https://www.ruby-forum.com/t/formatting-text-in-view-mode-same-as-edit-mode/156733/3 "2009-01-02T07:16:38Z")

</div>

Hi  
thanks for your reply…But one problem is pre takes enter keys Thats  
ok…But suppose in edit mode suppose if I continue my typing without  
pressing enter key and i gave only spaces Then alos in edit mode  
everything happen ok automaticaaly each letter goes to new line when it  
reaches extreme right…But in the view mode space wont be recognized by  
pre …For that what should I do

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [January 2, 2009, 7:19am UTC](https://www.ruby-forum.com/t/formatting-text-in-view-mode-same-as-edit-mode/156733/4 "2009-01-02T07:19:57Z")

</div>

Hi  
Solved it with width option of pre  
Sijo
