Ruby on Rails Monday, March 31, 2014

On Mon, Mar 31, 2014 at 11:32 AM, Jan Yo <lists@ruby-forum.com> wrote:
> Using Rails 4. I have a text_area_tag with submit_tag to do a query. I
> need to add a button to clear out the textarea and resubmit the form
> (using form_tag)
>
> Layout looks like this:
> Textarea
> Query Button 1 Clear Button
>
> Code looks like this:
> form_tag ....
> text_area_tag
> submit_tag "Query Button"
> end form tag
>
> Any ideas? Ajax was suggested.

?! Why would you want to submit an empty form?

Regardless, just create another submit button with an onsubmit
handler to set the textarea value to "".

But I still can't imagine your use case...

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yB7G-ON627RSfuD-JzFKyZiPwDtHakgN4b3yZ%3D%3DZYOxdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment