How to Validate HtmlEditor

  1. #1

    How to Validate HtmlEditor

    Hi friends,
    I am using HtmlEditor in mypage (This editor is in the window).

    I dont want user to send message with empty text (user might have entered some spaces and pressed enter key).

    Please tell me how to validate this for HtmlEditor.
    Here is my code

    <ext:HtmlEditor ID="editor" runat="server" Anchor="100%" EnableSourceEdit="false"
                                EnableLinks="false" EnableFontSize="false" EnableColors="false" EnableAlignments="false" MaskRe="[^<>]" >
                                <Listeners>
                                <AfterRender Handler="#{editor}.setReadOnly(false);" />
                                </Listeners>
                                </ext:HtmlEditor>
    There is no property like "AllowBlank".



    Thank you.
  2. #2

    can you have the answer for this query?

    I have the same issue. If any one know the answer please respond to this thread.
  3. #3

    Hi

    You can manually validate by this approach:
    - create a label under the htmleditor, with Hidden= true, and custom css for it same an error message.
    - When you click submit button, you will check value of html editor as following and show/hidden the label:
    ***This is label:
    <ext:Label ID="lblCheckHtmlEditor" runat="server" Hidden="true" Text="Do not empty" Cls="errMessageStyle" Icon="BulletError" />
    ***This is css:
    .errMessageStyle
            {
                color: #c0272b;
                margin-top:0px;
                font:normal 11px tahoma, arial, helvetica, sans-serif;
            }
    ***This is htmlEditor:
    <ext:HtmlEditor ID="HE1" FieldLabel="html Label" runat="server" Height="150" Width="600" AutoScroll="true" MaxHeight="150">
                        </ext:HtmlEditor>
    ***This is check function javascript:
    function checkValidForm() {
                var htmlEditorValue = HE1.getValue();
                var s = htmlEditorValue.replace(/<br>/gi, "").replace(/&nbsp;/gi, "").replace(/ /gi, "");
                if (s == "") {
                    lblCheckHtmlEditor.setVisible(true);
                    return;
                } else {
                    lblCheckHtmlEditor.setVisible(false);
                    <%-- Action you want to excute, etc show a window, ... --%>
                }
                
            };
    Last edited by and89; Jun 07, 2013 at 7:27 AM.

Similar Threads

  1. Replies: 0
    Last Post: Jun 15, 2012, 11:49 AM
  2. [CLOSED] ListView with HtmlEditor -> HtmlEditor value is null
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Apr 17, 2012, 12:50 AM
  3. V(0.8) How to Validate Combo Box??
    By rbalajiprasad in forum 1.x Help
    Replies: 0
    Last Post: Sep 02, 2010, 9:05 AM
  4. How can i validate tabpanel?
    By walle in forum 1.x Help
    Replies: 0
    Last Post: Jun 30, 2010, 12:13 PM
  5. Validate
    By davidhoyt in forum 1.x Help
    Replies: 2
    Last Post: Dec 13, 2008, 2:13 AM

Tags for this Thread

Posting Permissions