Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Editor > RadEditor - Required field validator

Not answered RadEditor - Required field validator

Feed from this thread
  • Bader Master avatar

    Posted on Oct 27, 2011 (permalink)

    Hi,

    Baed on http://demos.telerik.com/aspnet-ajax/editor/examples/validators/defaultcs.aspx, how can I hide the required filed validator of RadEditor immediately after filling the content and clicking out of it, without clicking on the "Submit" button? exactly like the required filed validators of other controls in the form.

    Regards,
    Bader

    Reply

  • Rumen Rumen admin's avatar

    Posted on Oct 28, 2011 (permalink)

    Hello Bader,

    You can attach to the blur event of the content area of RadEditor and execute your own validation code. You can see how to attach to the editor's content area events in this article: attachEventHandler.

    For example:
    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="checkLength"></telerik:RadEditor>
    <script type="text/javascript">
        var limitNum = 50;
     
        function checkLength(editor, args) {
             
            var element = document.all ? editor.get_document().body : editor.get_document();
            $telerik.addExternalHandler(element, "blur", function (e) {
                if (editor.get_text().length > limitNum) {
                    alert("The text length should not exceed " + limitNum + " symbols.");
                    editor.setFocus();
                }
            });
        
    </script>


    Greetings,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

  • Armando avatar

    Posted on Feb 6, 2012 (permalink)

    Hi, I use too the RadEditor control. In my case this is my control code

    <telerik:RadEditor ID="RadEditorSumario" runat="server" Skin="Office2007" SpellCheckSettings-DictionaryLanguage="es-ES"
    Width="400px" ContentFilters="None" NewLineBr="true">
    <Tools>
    <telerik:EditorToolGroup>
    <telerik:EditorTool Name="Bold" />
    <telerik:EditorTool Name="Italic" />
    <telerik:EditorTool Name="Underline" />
    <telerik:EditorTool Name="LinkManager" />
    <telerik:EditorTool Name="StrikeThrough" />
    <telerik:EditorTool Name="Undo" />
    <telerik:EditorTool Name="Redo" />
    <telerik:EditorTool Name="InsertOrderedList" />
    <telerik:EditorTool Name="InsertUnorderedList" />
    <telerik:EditorTool Name="JustifyLeft" />
    <telerik:EditorTool Name="JustifyCenter" />
    <telerik:EditorTool Name="JustifyRight" />
    <telerik:EditorTool Name="JustifyFull" />
    <telerik:EditorTool Name="PastePlainText" />
    <telerik:EditorTool Name="PasteAsHtml" />
    <telerik:EditorTool Name="AjaxSpellCheck" />
    </telerik:EditorToolGroup>
    </Tools>
    </telerik:RadEditor>
    <asp:CustomValidator ID="cvSumario2" runat="server" ControlToValidate="RadEditorSumario"
    Text="(*)" ErrorMessage="Debe ingresar el sumario o descripción del pillate la foto"
    ForeColor="Red" ClientValidationFunction="ValidarCampoObligatorioRegEx" />


    I resolved the problem with this javascript

    function ValidarCampoObligatorioRegEx(source, args) {
    var pattern = "^(<br>|<br/>|<BR>|<BR/>|&nbsp;|\\s)*$";
    var regex = new RegExp(pattern);
    var text = args.Value;
    var doMatch = text.match(regex);
    args.IsValid = !(doMatch);
    }

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Editor > RadEditor - Required field validator
Related resources for "RadEditor - Required field validator"

ASP.NET Editor Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]