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

[Solved] Validate Selected HTML

1 Answer 84 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Rana
Top achievements
Rank 2
Rana asked on 07 Jul 2009, 09:22 AM
Hi,
I would like to validate the selected Text's HTML in design view of RAD Editor.
For ex: I have 2 html tables on my editor with 2 rows each and each row has got some data like 1, 2, 3 etc.,
If user selects 2nd Row of First Table and 1st Row of 2nd Table, i need to alert him as INVALID selection.

    1

    2


    3


Any help would be appreciated.

Thanks,
Prat

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 09 Jul 2009, 01:04 PM
Hello Rana,

RadEditor offers rich client-side API which you can use to achieve your scenario: Getting familiar with Client-Side API.

You can use the code below as a base to proceed:

 <script type="text/javascript"
function OnClientLoad(editor, args) 
   var element = document.all ? editor.get_document().body : editor.get_document(); 
   $telerik.addExternalHandler(element, "click"function(e) 
   { 
       var selectedElement = editor.getSelectedElement(); 
       alert(selectedElement.tagName); 
   }); 
</script> 
<telerik:radeditor 
   runat="server" 
   OnClientLoad="OnClientLoad" 
   ID="RadEditor1"
</telerik:radeditor>  

Please, note that Internet Explorer does not allow multiple selections in the editable elements.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Editor
Asked by
Rana
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Share this question
or