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

How can we come out of RadEditor using Tab?

3 Answers 158 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Swadeesh
Top achievements
Rank 1
Swadeesh asked on 11 Nov 2009, 10:02 AM
hello friends,

i am using the RadEditor in my application.

in my .aspx page i have some controls in the middle of those controls RadEditor is present, so i set the focus to the first controls on my aspx page, when ever i open my .aspx page focus is coming the first control after that i am pressing the Tab key  it is going to the next control, once it reaches to the RadEditor control(i.e., in the content area) if i press the Tab within that content area only focus is moving that is also fine. Now, my problem is i had some controls after RadEditor, so how can i move the focus to those controls using Tab key .

Thanks.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Nov 2009, 12:40 PM
Hi Swadeesh,

Try adding following client side code in order to change the behavior when pressing Tab key.

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

JavaScript:
 
<script type="text/javascript">  
function OnClientLoad(editor, args)  
   editor.attachEventHandler("onkeydown"function(e)  
   {  
       editor.removeShortCut("InsertTab");  
       if(e.keyCode == '9')  
       {  
            if ($telerik.isSafari)  
            {  
                $get("Button1").focus();  
                e.preventDefault();  
                e.preventBubble();  
                e.stopPropagation();                
            }  
       }  
   });  
}  
</script> 

Regards,
Shinu.
0
Almannan
Top achievements
Rank 1
answered on 23 Jan 2012, 12:44 PM
Applied the following code, but still on pressing Tab, the focus does not come out of the editor.
The font name and size is applied as verdana and 10px.
 function OnClientLoad(editor, args) {
            var style = editor.get_contentArea().style;
            style.fontFamily = "Verdana";
            style.fontSize = 10 + "px";
            editor.removeShortCut("InsertTab");

            editor.attachEventHandler("onkeydown", function (e) {
                editor.removeShortCut("InsertTab");
                if (e.keyCode == '9') {
                    if ($telerik.isSafari) {
                        $get("Button1").focus();
                        e.preventDefault();
                        e.preventBubble();
                        e.stopPropagation();
                    }
                }
            });  
        }
0
Richard
Top achievements
Rank 1
answered on 24 Jan 2012, 05:25 PM
Wenche:

In reading your post, I'm still uncertain as to the behavior that you are trying to implement. The handling of a "tab" key press event is browser specific, so you will need to do some browser sniffing and write your code to support the various browsers that your end users will employ.

Telerik has provided a static client library to assist with handing browser versions. You can reference this for your "if" functionality.

The implementation of both "tab" key press behaviors, inserting a tab in the content area of the RadEditor versus tabbing to another form control/element, are covered in depth in this forum post: RadEditor Tab Key focus on another control in firefox while in IE it inserts whitespace

Hope that this helps!

Tags
General Discussions
Asked by
Swadeesh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Almannan
Top achievements
Rank 1
Richard
Top achievements
Rank 1
Share this question
or