Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7581783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:16:36+00:00 2026-05-30T18:16:36+00:00

I am implementing client validation using the Validate plugin for jQuery, and coming short

  • 0

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() {
    jQuery("#wpsm_body").addClass("required");
    jQuery("#wpsm-send-mail")
            .validate(
                    {
                        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.

Added: While I don’t believe this will help much at all, here is the HTML rendered to the browser. The HTML generated by TinyMCE subsequent to this is 400 lines long, and not relevant.

<form id="wpsm-send-mail" action="theform.php" method="POST" enctype="multipart/form-data">
<div id="wp-wpsm_body-wrap" class="wp-editor-wrap tmce-active">
    <link rel='stylesheet' id='editor-buttons-css' href='http://localhost/wordpress/wp-includes/css/editor-buttons.dev.css?ver=20111114'
        type='text/css' media='all' />
    <div id="wp-wpsm_body-editor-tools" class="wp-editor-tools">
        <a id="wpsm_body-html" class="hide-if-no-js wp-switch-editor switch-html" onclick="switchEditors.switchto(this);">
            HTML</a> <a id="wpsm_body-tmce" class="hide-if-no-js wp-switch-editor switch-tmce"
                onclick="switchEditors.switchto(this);">Visual</a>
        <div id="wp-wpsm_body-media-buttons" class="hide-if-no-js wp-media-buttons">
            <a href="http://localhost/wordpress/wp-admin/media-upload.php?post_id=0&#038;TB_iframe=1"
                class="thickbox add_media" id="wpsm_body-add_media" title="Add Media" onclick="return false;">
                Upload/Insert
                <img src="http://localhost/wordpress/wp-admin/images/media-button.png?ver=20111005"
                    width="15" height="15" /></a></div>
    </div>
    <div id="wp-wpsm_body-editor-container" class="wp-editor-container">
        <textarea class="wp-editor-area" rows="20" cols="40" name="wpsm_body" id="wpsm_body"></textarea></div>
</div>
</form>

The only relevant items here are the form and textarea, and their id attributes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:16:38+00:00Added an answer on May 30, 2026 at 6:16 pm

    Assuming You have already included the js file for tinyMCE and you are doing the validation on client side using tinyMCE

    Following is the code to validate the tinyMCE editor

    <script>  
        $(document).ready(function () {  
    
            var $btn = $("#<%=btnSubmit.ClientID %>");  
            var $txtEditor = $(".txtEditor");  
    
            $btn.click(function () {  
                if (tinyMCE.get($txtEditor.attr("id")).getContent() == "") {  
                    alert("hi");  
                }  
                else {  
                    alert("bye");  
                }  
                return false;  
            })  
    
        });  
    
    </script>  
    
    
    <div>  
    <asp:TextBox id="TextBox1" runat="server" TextMode="MultiLine" CssClass="txtEditor212"></asp:TextBox>  
                <asp:TextBox id="txtEditor" runat="server" TextMode="MultiLine" CssClass="txtEditor"></asp:TextBox>  
            </div>  
            <div>  
            <asp:Button id="btnSubmit" runat="server" Text="Save" onclick="btnSubmit_Click" />  
    
            </div>  
    </asp:Content>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently implementing a client-side paging solution using ASP.NET, jQuery and JSON. I
I am implementing client side validation in mvc3. I got my form showing via
When I started using xVal for client-side validation, I was only implementing action methods
I'm currently implementing a client application that POST's a file over HTTP and have
I am implementing a client library for a private HTTP-API using python requests .
I am implementing Javascript Validation on an ASP.Net page that is inside a Master
I need help figuring out how to succeed in implementing unobtrusive client-side validation of
I'm implementing client web service from .wsdl in C++ using gSOAP library. And i
I'm implementing a client/server application using UDP transmissions. Here is my part of my
I come into a trouble implementing a Flex 3.0.0 client that receives compressed HTTP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.