This is a migrated thread and some comments may be shown as answers.

RadEditor validation with RequiredFieldValidator not working as expected

3 Answers 233 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Fanie
Top achievements
Rank 1
Fanie asked on 01 Nov 2018, 07:55 AM

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 (.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="" 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.

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 05 Nov 2018, 03:17 PM
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.
0
Fanie
Top achievements
Rank 1
answered on 22 Feb 2019, 01:27 PM

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.

0
Peter Milchev
Telerik team
answered on 27 Feb 2019, 09:20 AM
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.
Tags
Editor
Asked by
Fanie
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Fanie
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question
or