# Cheap hack way to clear a form?

**URL:** <https://www.ruby-forum.com/t/cheap-hack-way-to-clear-a-form/172162>\
**Category:** Rails\
**Created:** [July 16, 2009, 12:19am UTC](https://www.ruby-forum.com/t/cheap-hack-way-to-clear-a-form/172162 "2009-07-16T00:19:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jedrin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/47e85d/32.png) [@Jedrin](https://www.ruby-forum.com/u/Jedrin)\
**Post date:** [July 16, 2009, 12:19am UTC](https://www.ruby-forum.com/t/cheap-hack-way-to-clear-a-form/172162/1 "2009-07-16T00:19:31Z")

</div>

I accidentally figured out a sort of hack way to clear a form. I saw  
you can write javascript to do this, but if you re render the form in  
a partial with a different name for the form like  
name=‘something224554’ based on a random number, it clears the form  
(at least in FF). I am curious how acceptable or lousy way people  
might think this is.

---

<div class="post-metadata">

**Author:** ![Jedrin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/47e85d/32.png) [@Jedrin](https://www.ruby-forum.com/u/Jedrin)\
**Post date:** [July 16, 2009, 12:55am UTC](https://www.ruby-forum.com/t/cheap-hack-way-to-clear-a-form/172162/2 "2009-07-16T00:55:34Z")

</div>

Jedrin wrote:

> I accidentally figured out a sort of hack way to clear a form. I saw  
> you can write javascript to do this, but if you re render the form in  
> a partial with a different name for the form like  
> name=‘something224554’ based on a random number, it clears the form  
> (at least in FF). I am curious how acceptable or lousy way people  
> might think this is.

It’s clever but unnecessary. already exists in  
HTML, and has the same effect.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
