How do I tell CE not to validate the length on a cancel?

Last post 09-07-2011, 7:00 AM by ceblanda. 2 replies.
Sort Posts: Previous Next
  •  09-01-2011, 8:45 AM 69912

    How do I tell CE not to validate the length on a cancel?

    I have a CE dialog with a MaxLength = 6000, and below it a Submit and a Cancel button as below:
     
    <asp:button id="SaveButton" Runat="server"></asp:button>
    <asp:button id="CancelButton" CausesValidation="False" Runat="server"></asp:button>
     
    If the text in the CE exceeds 6000 chars and the user hits cancel, the length validation message appears and the postback does not occur.  The user has to clear out the CE dialog to be able to cancel!  How do I stop the error and allow the postback?
  •  09-02-2011, 9:53 AM 69922 in reply to 69912

    Re: How do I tell CE not to validate the length on a cancel?

    Hi ceblanda,
     
    Please try the examle below
     
    <%@ Page Language="C#" EnableViewState="false" %>

    <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>GetPlainText</title>
    </head>

    <script runat="server">
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            label1.Text = "postback!";
        }
    </script>

    <body>
        <form id="form1" runat="server">
            <CE:Editor ID="editor1" runat="server" MaxTextLength="1">
            </CE:Editor>
            <asp:Button ID="btnSave" runat="server" Text="save" />
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="test()" OnClick="btnCancel_Click" />
            <asp:Label ID="label1" runat="server"></asp:Label>
        </form>
    </body>
    </html>

    <script>
    function test()
    {
        var editor1=document.getElementById("<%= editor1.ClientID %>");
       editor1.setHTML("");
    }
    </script>
     
    Regards,
     
    Ken
  •  09-07-2011, 7:00 AM 69975 in reply to 69922

    Re: How do I tell CE not to validate the length on a cancel?

    While this looks like it would work, I would have to add it to every page that contains CE and then maintain them all.  Can this be addressed properly in the next version?
     
View as RSS news feed in XML