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

how to set focus to radEditor body on click of tab of previous control?

4 Answers 238 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Abhijit Shetty
Top achievements
Rank 2
Abhijit Shetty asked on 17 Oct 2010, 08:07 AM
Hi Everyone,

I dont know whether this have asked before or not?

I have a radeditor with basic controls enabled[B,I,U,fontColor...], before which i have a radcombo box.
Now i set TabIndex to radcombobox as 1 and to radeditor as 2
is it possible to get the focus on radeditor text area instaead of complete radeditor on click of tab in radcombobox or else i have to use javascript?


Thanks in advance for helping

4 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 20 Oct 2010, 04:25 PM
Hi Abhijit,

Here is an example on how to proceed in your scenario:
<telerik:RadEditor ID="RadEditor1"OnClientLoad="OnClientLoad"  runat="server"></telerik:RadEditor>
<script type="text/javascript">
    functionOnClientLoad(editor, args) {
        editor.removeShortCut("InsertTab");
 
        varbuttonsHolder = $get(editor.get_id() + "Top"); //get a reference to the top toolbar zone of the editor 
        varbuttons = buttonsHolder.getElementsByTagName("A"); //get a reference to all A elements on the toolbar and disable the tabbing trough them 
        for(vari = 0; i < buttons.length; i++) {
            vara = buttons[i];
            a.tabIndex = -1;
            a.tabStop = false;
        }
 
    }
</script>
<asp:Button ID="Button1"runat="server"Text="Button"/>


You can also see the code of this demo: Accessible Editor.




Greetings,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
UmaKiran
Top achievements
Rank 1
answered on 16 Nov 2010, 10:51 AM
hi,
am using a plain rad editor.
<trk:RadEditor ToolsFile="~/Telerik/Config/ToolsBasic.xml"
                                    ID="RadEdior1" ContentFilters="RemoveScripts" EditModes="Design" runat="server">.
Am not displaying any tools which gives an impression to the user it is just a plain text box.
 I have three controls on my page. Two text boxes and a radeditor. Radeditor is placed as third control. When the user press tab twice the focus should be set to editor. But it is not. I tried with client side script something like
function OnKeyPress(e) {
                alert("Handler for .OnKeyPress() called.");
                var editor = $find("<%= RadEdior1.ClientID %>");

                if (window.event)        // IE
                {
                    Key = window.event.keyCode;
                }
                else if (e.which) // Netscape/Firefox/Opera
                {
                    Key = e.which;
                }            
                if (Key == 9) {
                    editor.removeShortCut("InsertTab");    
                    alert("hi am inside");
                    editor.setFocus();
                }
            }
am callin this script from second text box. it is like
<asp:TextBox ID="txtBox2" runat="server" onKeyDown='javascript:OnKeyPress(event)'></asp:TextBox>
But the focus is set to entire editor, where as i want that to focus on only text area.

Thanks In Advance.
UmaKiran
0
cvsayani
Top achievements
Rank 1
answered on 16 Nov 2010, 12:47 PM
Try this... I have added setTimeOut when you setFocus
function OnKeyPress(e) {
                alert("Handler for .OnKeyPress() called.");
                var editor = $find("<%= RadEdior1.ClientID %>");

                if (window.event)        // IE
                {
                    Key = window.event.keyCode;
                }
                else if (e.which) // Netscape/Firefox/Opera
                {
                    Key = e.which;
                }            
                if (Key == 9) {
                    editor.removeShortCut("InsertTab");    
                    alert("hi am inside");
                    setTimeOut(function() { editor.setFocus(); }, 100);
                }
            }
0
UmaKiran
Top achievements
Rank 1
answered on 16 Nov 2010, 01:39 PM
HI,
I tried this and is workin fine. Thanks for the solution.
Regards,
UmaKiran
Tags
Editor
Asked by
Abhijit Shetty
Top achievements
Rank 2
Answers by
Rumen
Telerik team
UmaKiran
Top achievements
Rank 1
cvsayani
Top achievements
Rank 1
Share this question
or