function ChangeTextEditorFieldValue(sender, args) {
var elem = sender.get_element();
var attributedElem = document.getElementById(elem.id + '_text');
var fieldName = attributedElem.getAttribute('fieldCode');
var oldValue = args.get_oldValue();
var newValue = args.get_newValue();
var editor = GetFormEditor();
if (!oldValue) {
var newhtml = ReplaceAll(editor.get_html(true), "{" + fieldName + "}", "[" + newValue + "]");
editor.set_html(newhtml);
...
When i do this, RadEditor got focus but I want to set focus to ELEM (textbox i've change) like this :
elem.focus();
but focus stay on radeditor. Why ??? I'm on IE9
6 Answers, 1 is accepted
The set_html() method sets the focus in RadEditor to set the content.
You can try two different approaches to fix the problem:
1) Set the content in RadEditor using
editor.get_document().body.innerHTML = newhtml;
2) or set the focus on the textbox after a small delay, e.g.
editor.set_html(newhtml);
setTimeout(function()
{
elem.focus();
}, 100);
Kind regards,
Rumen
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.


And similarly, the timeout/focus option does not change the focus from the editor either.
Is there no way to hand focus back after you've updated the content? I'm not sure I understand why we have to jump through hoops to get the focus back.
Thanks!

The editor.get_document().body.innerHTML = newhtml; method works perfectly. Provided you use innerHTML, not innerHtml :-)
I still think we shouldn't have to jump through the hoops, but at least it's an easy workaround ;-)
Thanks Rumen!

The discussed matter in this forum thread is entirely about client-side approaches and the mentioned editor.get_document().body.innerHTML = newhtml; line of code is written with JavaScript.
Regards,
Ianko
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.