1

Topic: getContent() returning "<p></p>" when the editor should be empty

Hi there,

I'm having a slight issue with regards to validation of an instance of a tinyMCE editor.

Upon form submission I'm simply testing whether the user has input something into the editor by using:

tinyMCE.get('intro_content').getContent({format:'text'})

The problem is if someone enters something then removes it all, the validation is being passed because the instance contains an empty paragraph tag "<p></p>".

Has anyone experienced this before? If so, is there a way to rectify it?

Regards,
Lee

2

Re: getContent() returning "<p></p>" when the editor should be empty

If you check the HTML code of the editor, you'll see that it keeps tags like that every now and then. On the server-side, do a striptags and see if the result if empty.

3

Re: getContent() returning "<p></p>" when the editor should be empty

@lee: Please read the FAQs before posting your first post in a forum. Thank you.

After you provide the necessary info somebody can then point you into the right direction(s)... There are some settings in TinyMCE which might cause your experience, such as force_p_newlines (which defaults to "true"), force_br_newlines (which defaults to "false") and forced_root_block (which defaults to "false").

Since you haven't given even the slightest piece of information I can't really tell you where to start fixing.

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)