homepage Welcome to WebmasterWorld Guest from 54.211.68.132
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
Forum Library, Charter, Moderator: open

WYSIWYG and Text Code Editors Forum

    
TinyMCE textarea validation
Sub_Seven




msg:4388223
 7:19 pm on Nov 17, 2011 (gmt 0)

Hello everyone,

I came across the need of using a rich text editor, I ended up choosing TinyMCE, it works real nice but no matter how much I've tried I can't get to validate the data prior to submitting it.

All I want is to make sure the textarea (which I believe is no longer a textarea since TinyMCE converts it into some other elements) is not empty, I have tried several examples on their forum with no luck so I'm trying my luck here.

Has anyone dealt with this issue? Thanks.

 

enigma1




msg:4391441
 12:26 pm on Nov 27, 2011 (gmt 0)

You could use the getContent and check if the content is empty.
[tinymce.com...]

So you hook the submit button and check if there is any content before allowing or setting the form action.

coopster




msg:4402992
 7:07 pm on Jan 2, 2012 (gmt 0)

And if you have more than one instance of the editor running you may want to use the triggerSave() method:

[tinymce.com...]

If you want to focus on any element after realizing it is empty you can use the execCommand:

[tinymce.com...]
[tinymce.com...]

pseudocode example:
if (your textarea has an error) { 
tinyMCE.execCommand('mceFocus', false, 'textareaID');
return false;
}

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved