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

RadEditor Validation property

1 Answer 76 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Suprodeep
Top achievements
Rank 1
Suprodeep asked on 18 Dec 2008, 10:37 AM
Hi,

I am using a RadEditor and i want to implement a functionality through which user cannot leave the editor as blank.  Please suggest with some sample code.  IE i want to implement validation.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 22 Dec 2008, 09:09 AM
Hello Suprodeep,

Here is an example how to execute validation code when the editor loses focus:

<telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad">
       <Content></Content>
</telerik:RadEditor>

<script type="text/javascript"> 
function OnClientLoad(editor, args) 

    var element = document.all ? editor.get_document().body : editor.get_document(); 
    $telerik.addExternalHandler(element, "blur", function(e) 
    { 
        if (editor.get_text() == "")
           alert('Please, enter content'); 
    }); 

</script>

Sincerely yours,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Suprodeep
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or