# Submit\_to\_remote onclick clear?

**URL:** <https://www.ruby-forum.com/t/submit-to-remote-onclick-clear/160811>\
**Category:** Rails\
**Created:** [February 19, 2009, 10:34pm UTC](https://www.ruby-forum.com/t/submit-to-remote-onclick-clear/160811 "2009-02-19T22:34:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![loader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5daacb/32.png) [@loader](https://www.ruby-forum.com/u/loader)\
**Post date:** [February 19, 2009, 10:34pm UTC](https://www.ruby-forum.com/t/submit-to-remote-onclick-clear/160811/1 "2009-02-19T22:34:16Z")

</div>

Hello everyone!

I would like to clear my textarea when the user click on the “Submit”  
button.  
Ths thing is I’m using a submit\_to\_remote button. I heard that’s  
impossible to add an option onclick to clear my textarea.

\<%= submit\_to\_remote ‘comment’, ‘Submit’, ajax\_options(:url =\> {  
:controller =\> ‘/ticket\_comments’, :action =\> :create }, :update =\>  
{:success =\> “comment\_list”}, :validation =\> true) %\>

Do you have an idea?

Thank you!

---

<div class="post-metadata">

**Author:** ![loader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5daacb/32.png) [@loader](https://www.ruby-forum.com/u/loader)\
**Post date:** [February 23, 2009, 6:26pm UTC](https://www.ruby-forum.com/t/submit-to-remote-onclick-clear/160811/2 "2009-02-23T18:26:15Z")

</div>

Nobody knows? ☹

---

<div class="post-metadata">

**Author:** ![loader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5daacb/32.png) [@loader](https://www.ruby-forum.com/u/loader)\
**Post date:** [February 23, 2009, 7:25pm UTC](https://www.ruby-forum.com/t/submit-to-remote-onclick-clear/160811/3 "2009-02-23T19:25:20Z")

</div>

On Feb 23, 5:26 pm, Guillaume L. \<rails-mailing-l…@andreas-  
[s.net](http://s.net)\> wrote:

> Nobody knows? ☹

Well you can certainly add the usual ajax callbacks (onComplete,  
onSuccess etc… (and those might be preferable to a raw onclick - you  
might not want to reset the field if the user clicks submit but your  
server then raises an error).

Fred

> 

–
