This content has been marked as final.
Show 4 replies
-
1. Re: <rich:editor> How to set Focus
user1234 Dec 17, 2009 8:07 AM (in response to boldoran)could you check how its rendering , by checking render html code. there you can get the input field you are looking for, and then you can set focus to it by javascript -
2. Re: <rich:editor> How to set Focus
ilya_shaikovsky Dec 17, 2009 8:23 AM (in response to boldoran)1 of 1 people found this helpful -
3. Re: <rich:editor> How to set Focus
boldoran Dec 17, 2009 10:03 AM (in response to boldoran)Thank you for setting me on the right track.
tinyMCE.execInstanceCommand("mce_editor_0", "mceFocus");
this did not work right away for me. However I found this forum entry
http://tinymce.moxiecode.com/punbb/viewtopic.php?id=4561
after some fiddling here is what worked:
<rich:editor id="editor" width="750" value="#{backingBean.text}" oninit="setTimeout( function() { tinyMCE.execCommand('mceFocus',false,'FORMID:editorTextArea'); }, 1); />
editorTextArea is the id of the TextArea that is generated in the html code (check with firebug or examine html sourcecode to find it) -
4. Re: <rich:editor> How to set Focus
boldoran Dec 17, 2009 10:16 AM (in response to user1234)could you check how its rendering , by checking render html code. there you can get the input field you are looking for, and then you can set focus to it by javascript
I could not find an input field that I could use for this purpose in the html code. The only InputField generated is a TextArea and it has visibility hidden. I guess the editor uses some javascript magic to work directly in the html code.
See above for a solution.