Validation unexpected behavior

  •  11-06-2006, 10:41 AM

    Validation unexpected behavior

    This works:

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
       
            <%  /*
            <asp:TextBox ID="txtTest" runat="server" />
            <asp:RequiredFieldValidator
                id="RequiredFieldValidator2"
                runat="server"
                EnableClientScript="true"
                ErrorMessage="RequiredFieldValidator"
                ControlToValidate="txtTest"
                Text="*" />
               
             */ %>
       
            <CE:Editor id="Editor1"
                runat="server"></CE:Editor>
            <asp:RequiredFieldValidator
                id="RequiredFieldValidator1"
                runat="server"
                EnableClientScript="true"
                ErrorMessage="RequiredFieldValidator"
                ControlToValidate="Editor1"
                Text="<h3>The body field is required!</h3>" />
            <asp:Button ID="btnTest"
                runat="server"
                OnClick="btnTest_Click"
                Text="Test" />
           
        </div>
        </form>
    </body>
    </html>

    But the page does postback.

    This validates the <asp:TextBox only:
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
       
            <asp:TextBox ID="txtTest" runat="server" />
            <asp:RequiredFieldValidator
                id="RequiredFieldValidator2"
                runat="server"
                EnableClientScript="true"
                ErrorMessage="RequiredFieldValidator"
                ControlToValidate="txtTest"
                Text="*" />
           
            <CE:Editor id="Editor1"
                runat="server"></CE:Editor>
            <asp:RequiredFieldValidator
                id="RequiredFieldValidator1"
                runat="server"
                EnableClientScript="true"
                ErrorMessage="RequiredFieldValidator"
                ControlToValidate="Editor1"
                Text="<h3>The body field is required!</h3>" />
            <asp:Button ID="btnTest"
                runat="server"
                OnClick="btnTest_Click"
                Text="Test" />
           
        </div>
        </form>
    </body>
    </html>

    The Editor is not validated.  What is the solution to this, thank you.


View Complete Thread