Weird...Editor doesn't allow focus

JavaScript related talks

Weird...Editor doesn't allow focus

Postby passion4code » Tue Feb 27, 2007 1:37 pm

I have an interesting problem, in an administrative module there is a checkbox that has a handler to flip the style.display of the <span> element holding the editor from "none" to "block". That part works fine, easy stuff...what is weird is that when it goes to "block" (so it is displayed) you cannot focus your cursor in the editor itself. The only way around it is to click Source twice and you can type in there.


Here is a snippet of where the editor is created, pretty standard
Code: Select all
   <span id='content_editor' style='<?php echo ($f_info['is_editable'] != 1 ? "display:none" : ""); ?>'>


                                       <?php
                                          include('FCKeditor/fckeditor.php');
                                          $f_editor = new FCKeditor('e_file_content') ;
                                          $f_editor->BasePath   = './FCKeditor/';
                                          $f_editor->Value      = $f_info['file_content'];
                                          $f_editor->Width = '500';
                                          $f_editor->Create();
                                       ?>


                              </span>



The javascript handler is as follows
Code: Select all
function file_content_toggle(){
                          var content_title = get_obj('content_editor_title');
                          var content_editor = get_obj('content_editor');

                     
                          if(document.file_edit.is_editable.checked){
                     
                                content_title.style.display='block';
                                content_editor.style.display='block';
                                document.file_edit.e_file_content.focus();
                          }
                          else{
                                content_title.style.dispay='none';
                              content_editor.style.display='none';
                          }
                     
                     
                     }


the get_obj call is basically like document.getElementById

I threw that document.file_edit.e_file_content.focus() call in there just to see if it would help...to no avail


Any help would be greatly appreciated[/quote]
You cannot solve the problems you've created with the same kind of thinking that created them -- Einstein
passion4code
 
Posts: 1
Joined: Tue Feb 27, 2007 1:24 pm

Postby tgersic » Thu Mar 22, 2007 11:40 am

I'm having the same problem. It only occurs in Firefox, not IE. A workaround would be much appreciated.
tgersic
 
Posts: 1
Joined: Thu Mar 22, 2007 11:39 am


Return to JavaScript

Who is online

Users browsing this forum: No registered users and 0 guests