# Validate the tinyMce textarea

**URL:** <https://www.ruby-forum.com/t/validate-the-tinymce-textarea/146892>\
**Category:** Rails\
**Created:** [August 26, 2008, 3:39pm UTC](https://www.ruby-forum.com/t/validate-the-tinymce-textarea/146892 "2008-08-26T15:39:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ravikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@ravikanth](https://www.ruby-forum.com/u/ravikanth)\
**Post date:** [August 26, 2008, 3:39pm UTC](https://www.ruby-forum.com/t/validate-the-tinymce-textarea/146892/1 "2008-08-26T15:39:17Z")

</div>

Hi,

```
  i am using the tinyMce text editor in my rails app.But how to

```

write the java script validation for that textarea?

my validation is:

```
  In that textarea all numbers are not allowed.

```

I am getting the data from textarea using  
tinyMce.get(“id”).getContent().  
but i am getting

1234

 this data from above code.

i dont want any html tags.i want only data what we entered in textarea.  
how to get that data?

thanks,  
Ravi.

---

<div class="post-metadata">

**Author:** ![ravikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@ravikanth](https://www.ruby-forum.com/u/ravikanth)\
**Post date:** [August 26, 2008, 3:46pm UTC](https://www.ruby-forum.com/t/validate-the-tinymce-textarea/146892/2 "2008-08-26T15:46:42Z")

</div>

On Tue, Aug 26, 2008 at 6:39 AM, Ravi K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am getting the data from textarea using  
> tinyMce.get(“id”).getContent().  
> but i am getting
> 
> 1234
> 
> this data from above code.
> 
> i dont want any html tags.i want only data what we entered in textarea.  
> how to get that data?

Ravi,

First off, this would probably be a better question for a Javascript  
mailing list as this isn’t really a rails-specific question.

In an effort to help you out, you’ll probably want to look at building  
an observer with javascript (using prototype.js) and validate that  
characters are non-numeric. I’m not sure how TinyMCE works completely,  
but it sounds like it’ll generate the html as you’re using it but I’d  
suspect that it’d key a variable in it’s namespace with the original  
content so that it could continue to reformat properly. Perhaps it’s  
has an html escape function that you could call to strip out the html.

Anyhow, that’s how I’d go about looking to create a solution to your  
goal.

Cheers,  
Robby

–  
Robby R.  
Chief Evangelist, Partner

PLANET ARGON, LLC  
design // development // hosting

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]
