| 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; }
|
|
|