I need to validate a form. This form has some dropdowns and tinyMCE editor, I am validating this form by appending the string “Required” after each field if it is blank, However I am unable to validate the tinyMCE editor, if the editor is blank, I tried something like
tinyMCE.get('tinyedotor').getContent();
but no luck.
here is my fiddle
getContent()should work just fine. Your fiddle doesn’t contain the form validation code for the editor value, which is quite crucial here. Try this:Forked fiddle
Also note you’ve declared multiple
id‘s for yourselectdrop-down.Edit: You can get the
idof the editor container with thegetContainer()method:tinyMCE.get('tinyeditor').getContainer(). Inserting an error message after the editor would then be something like this:This, however, will create a new
spaneach time the user clicks the submit button, so you’ll probably want to have an error message container with a uniqueidand check if the container already exists before inserting it.Edit 2: Updated fiddle.