# Form.text\_area, how do you empty its contents?

**URL:** <https://www.ruby-forum.com/t/form-text-area-how-do-you-empty-its-contents/152239>\
**Category:** Rails\
**Created:** [October 31, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/form-text-area-how-do-you-empty-its-contents/152239 "2008-10-31T18:35:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tyanlion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f0a364/32.png) [@tyanlion](https://www.ruby-forum.com/u/tyanlion)\
**Post date:** [October 31, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/form-text-area-how-do-you-empty-its-contents/152239/1 "2008-10-31T18:35:36Z")

</div>

Hi, after i click submit and refresh the parital(with  
page.replace\_html) with the remote\_form\_for, the \<%=  
form.text\_area :body, :rows =\> 10, :cols =\> 40 %\> still contains the  
previous text. how do i totally remove the text inside of it?

---

<div class="post-metadata">

**Author:** ![tyanlion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f0a364/32.png) [@tyanlion](https://www.ruby-forum.com/u/tyanlion)\
**Post date:** [October 31, 2008, 7:08pm UTC](https://www.ruby-forum.com/t/form-text-area-how-do-you-empty-its-contents/152239/2 "2008-10-31T19:08:25Z")

</div>

Never mind i got it  
@comment.body = “” before the page.replace

---

<div class="post-metadata">

**Author:** ![tyanlion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f0a364/32.png) [@tyanlion](https://www.ruby-forum.com/u/tyanlion)\
**Post date:** [October 31, 2008, 7:51pm UTC](https://www.ruby-forum.com/t/form-text-area-how-do-you-empty-its-contents/152239/3 "2008-10-31T19:51:47Z")

</div>

On further look investigation I haven’t really solved the problem. The  
text  
is erased after I submit the form but it still remains when I refresh  
the  
page.

---

<div class="post-metadata">

**Author:** ![tyanlion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f0a364/32.png) [@tyanlion](https://www.ruby-forum.com/u/tyanlion)\
**Post date:** [October 31, 2008, 8:24pm UTC](https://www.ruby-forum.com/t/form-text-area-how-do-you-empty-its-contents/152239/4 "2008-10-31T20:24:37Z")

</div>

That’s the browser doing that… I don’t think you can stop it from  
doing that on a refresh.

---

<div class="post-metadata">

**Author:** ![tyanlion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f0a364/32.png) [@tyanlion](https://www.ruby-forum.com/u/tyanlion)\
**Post date:** [October 31, 2008, 8:26pm UTC](https://www.ruby-forum.com/t/form-text-area-how-do-you-empty-its-contents/152239/5 "2008-10-31T20:26:57Z")

</div>

Yeah I managed to find out shortly after I typed that message  
page.form.reset

---

<div class="post-metadata">

**Author:** ![tyanlion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f0a364/32.png) [@tyanlion](https://www.ruby-forum.com/u/tyanlion)\
**Post date:** [October 31, 2008, 8:25pm UTC](https://www.ruby-forum.com/t/form-text-area-how-do-you-empty-its-contents/152239/6 "2008-10-31T20:25:12Z")

</div>

Actually… I’m sure you could do it with Javascript
