MaxHTMLLength validation occurs even when the button clicked has CausesValidation=false

Last post 09-02-2011, 9:53 AM by Kenneth. 2 replies.
Sort Posts: Previous Next
  •  03-11-2006, 11:29 AM 17019

    MaxHTMLLength validation occurs even when the button clicked has CausesValidation=false

    I have a CE 5.2 control on my page and 2 buttons, one that saves the page the other that takes them back, without saving to the listing of all items:
     
    <CE:Editor id="RemarksEditor" runat="server" ShowBottomBar="false" ConfigurationPath="~/CuteSoft_Custom/Configuration/minimal.config" MaxHTMLLength="800" Width="100%" Height="150px"></CE:Editor>
     
    <asp:Button ID="SaveAndContinue" Runat="server" Text="Next" />
    <asp:Button ID="CancelButton" Runat="server" Text="Cancel" CausesValidation="False" />
     
    If the user enters more than the 800 chars in the editor and then clicks cancel, the length validation fires and the page does not postback.  If a button is set to causesvalidation="false" the CE validation should not fire.
  •  09-01-2011, 8:53 AM 69913 in reply to 17019

    Re: MaxHTMLLength validation occurs even when the button clicked has CausesValidation=false

    I am having the exact same issue.  Did you find a way to resolve this?
  •  09-02-2011, 9:53 AM 69923 in reply to 69913

    Re: MaxHTMLLength validation occurs even when the button clicked has CausesValidation=false

    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
View as RSS news feed in XML