RadEditor validation with RequiredFieldValidator not working as expected

4 posts, 0 answers
  1. Fanie
    Fanie avatar
    12 posts
    Member since:
    Apr 2016

    Posted 01 Nov 2018 Link to this post

    I've been following https://demos.telerik.com/aspnet-ajax/editor/examples/validators/defaultcs.aspx to enable validation on my RadEditor control to make sure (1) it is not empty and (2) the entered content length is larger than a certain amount of characters.  The RadEditor control is on a WebUserControl (.ascx).  The validation happens when you click the update button.

    It seems to be working when there are no text entered, but when I enter any text of any length it stills shows me the empty text message and clears the editor control text. 

    <table id="editTable" style="border-collapse: collapse; border: 0; width: 100%">
            <tr class="EditFormHeader">
                <td colspan="3">
                    <b>Ticket Details</b>
                </td>
                <td>
                    <telerik:RadButton ID="btnUpdateTicket" runat="server" ValidationGroup="ValidateInput" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></telerik:RadButton>
                </td>
            </tr>

    <tr>
                <td class="auto-style2">Notes:</td>
                <td colspan="3">
                    <telerik:RadEditor ID="fldNote" runat="server" RenderMode="Lightweight" Skin="Metro" Width="98%" Height="200px" EditModes="Design" ContentFilters="RemoveScripts" >
                        <Tools>
                            <telerik:EditorToolGroup Tag="MainToolbar">
                                <telerik:EditorTool Name="FindAndReplace" />
                                <telerik:EditorSeparator />
                                <telerik:EditorSplitButton Name="Undo">
                                </telerik:EditorSplitButton>
                                <telerik:EditorSplitButton Name="Redo">
                                </telerik:EditorSplitButton>
                                <telerik:EditorSeparator />
                                <telerik:EditorTool Name="Cut" />
                                <telerik:EditorTool Name="Copy" />
                                <telerik:EditorTool Name="Paste" ShortCut="CTRL+V / CMD+V" />
                            </telerik:EditorToolGroup>
                            <telerik:EditorToolGroup Tag="Formatting">
                                <telerik:EditorTool Name="Bold" />
                                <telerik:EditorTool Name="Italic" />
                                <telerik:EditorTool Name="Underline" />
                                <telerik:EditorSeparator />
                                <telerik:EditorSplitButton Name="ForeColor">
                                </telerik:EditorSplitButton>
                                <telerik:EditorSplitButton Name="BackColor">
                                </telerik:EditorSplitButton>
                                <telerik:EditorSeparator />
                                <telerik:EditorDropDown Name="FontName">
                                </telerik:EditorDropDown>
                                <telerik:EditorDropDown Name="RealFontSize">
                                </telerik:EditorDropDown>
                            </telerik:EditorToolGroup>
                        </Tools>
                    </telerik:RadEditor>
                    <asp:RequiredFieldValidator ID="NoteValidator" runat="server" Display="Static" CssClass="validator" ControlToValidate="fldNote">Please add a note!</asp:RequiredFieldValidator>
                   <%-- <asp:CustomValidator runat="server" ID="EditorLengthValidator" ControlToValidate="fldNote" Display="Static" CssClass="validator" ClientValidationFunction="TelerikDemo.checkLength">***Your note is too short!!***</asp:CustomValidator><br />--%>

     

    If commented out the CustomValidator controls to eliminate it as an issue, so now it doesn't have to check the lenght. 

    I'm using version 2018.3.910.45 of the ASP.NET AJAX controls.

    I've gone through some of the thread, but not helped so far.

  2. Rumen
    Admin
    Rumen avatar
    14100 posts

    Posted 05 Nov 2018 Link to this post

    Hi Fanie,

    Can you remove the ValidationGroup="ValidateInput" property from RadButton and this will fix the issue?

    Regards,
    Rumen
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Fanie
    Fanie avatar
    12 posts
    Member since:
    Apr 2016

    Posted 22 Feb in reply to Rumen Link to this post

    Thanks, I got the validating that text was entered working.  But now I'm trying to validate the length and that is not working.

    I've changed my code to your example, but it still isn't working.

    PS.  Sorry for the late reply on this, other projects took priority.

  4. Peter Milchev
    Admin
    Peter Milchev avatar
    613 posts

    Posted 27 Feb Link to this post

    Hello Fanie,

    The project that Rumen attached seems to validate both validators, attached is a fully runnable project to verify that: https://screencast-o-matic.com/watch/cqntQq0IA1. If you are using a .NET framework version 4.0 or later, please ensure that the following key is added to the web.config: http://stackoverflow.com/questions/16660900/webforms-unobtrusivevalidationmode-requires-a-scriptresourcemapping-for-jquery

    <configuration>
      <appSettings>
     ...
        <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
      </appSettings>

    If that does not help to resolve the issue, please modify the attached project and send it back to us in an official support ticket. That would allow us to further investigate the issue and provide more specific and accurate suggestions. 

    Once we have a full solution to the issue, we can share it here for convenience and better visibility from the community.

    Regards,
    Peter Milchev
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top