Click here to Skip to main content
15,312,347 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am implementing client validation using the Validate plugin for jQuery, and coming short with a form field that uses the TinyMCE editor component. This renders an incredibly complex control tree under the containing tag for my form field, including an iframe for the actual editing area, and a textarea element. I cannot access the textarea directly, so I add the required attribute before calling .validate(), like below:

jQuery(function() {
                        errorContainer : "#wpsm-top-error-container, #wpsm-bottom-error-container",
                        errorLabelContainer : "#wpsm-top-error-container ul",
                        wrapper : "li",
                        messages : {
                            wpsm_from : "The message has no 'From' address. The administrator can set a default for this on the SuperMail 'Settings' page.",
                            wpsm_subject : "The message has no subject.",
                            wpsm_body : "The message has no body.",
                            wpsm_text : "The message has no body."

However, I get no client validation error when I submit the form even with an empty wpsm_body.

For background, this is inside a WordPress plugin, and TinyMCE is rendered by the wp_editor function, although I doubt this makes too much difference.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900