# How to clear certain form fields with RJS?

**URL:** <https://www.ruby-forum.com/t/how-to-clear-certain-form-fields-with-rjs/131291>\
**Category:** Rails\
**Created:** [March 7, 2008, 6:09pm UTC](https://www.ruby-forum.com/t/how-to-clear-certain-form-fields-with-rjs/131291 "2008-03-07T18:09:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eggman2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/51bf81/32.png) [@eggman2001](https://www.ruby-forum.com/u/eggman2001)\
**Post date:** [March 7, 2008, 6:09pm UTC](https://www.ruby-forum.com/t/how-to-clear-certain-form-fields-with-rjs/131291/1 "2008-03-07T18:09:49Z")

</div>

I have a form, which when submitted updates certain page elements  
using RJS. Within the form, I have a few text fields, which I would  
like to clear upon submission. Can someone tell me what I would need  
to do to do this?

---

<div class="post-metadata">

**Author:** ![eggman2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/51bf81/32.png) [@eggman2001](https://www.ruby-forum.com/u/eggman2001)\
**Post date:** [March 8, 2008, 2:07am UTC](https://www.ruby-forum.com/t/how-to-clear-certain-form-fields-with-rjs/131291/2 "2008-03-08T02:07:46Z")

</div>

eggman2001 wrote:

> I have a form, which when submitted updates certain page elements  
> using RJS. Within the form, I have a few text fields, which I would  
> like to clear upon submission. Can someone tell me what I would need  
> to do to do this?

Provide id’s to the forms you would like to clear and then just call  
them out in your rjs

page[‘form\_field\_id’].replace\_html “”

hth

ilan
