FreeTextBox

The no. 1 free ASP.NET HTML Editor.
Welcome to FreeTextBox Sign in | Join | Help
in Search

showing/hiding in firefox causes problems with freetextbox

Last post 10-22-2008, 3:17 PM by jhanoun. 13 replies.
Sort Posts: Previous Next
  •  04-27-2005, 11:08 PM 3895

    showing/hiding in firefox causes problems with freetextbox

    hello all,
    currently i'm experiencing a problem when the free text box starts out on the page as being inside a div with style="display:none;" while using FireFox.  basically what happens when the div style is changed to "display:block;" is that the editor appears but it's like the frame you type in is frozen.  also when the page loads, in the javascript console it has this error:

    Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.designMode]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: http://localhost/Common/FreeTextBox/FTB-FreeTextBox.js :: FTB_FreeTextBox :: line 96"  data: no]
    Source File: http://localhost/Common/FreeTextBox/FTB-FreeTextBox.js
    Line: 96

    That line is the following: 
       this.designEditor.document.designMode = 'On';

    So from what i've gathered the designMode of the iframe can't be set to On in FireFox if the iframe is nested inside a non-displayed element.  ok.  so how do we work around this problem?  i came up with a super ghetto way to make it work which involves 2 things - the first thing is having the div show as display:block to begin with and hiding it later, and the second is calling

    var ftb = document.getElementById(ftbID).contentWindow.document.ftb;
    ftb.GoToHtmlMode();
    ftb.GoToDesignMode();

    to make the ftb type-in-able. 

    is there a better way to do this?  like maybe a way to prevent the FTB from adding its initialize event to the page load and instead letting me initialize it after i've displayed the div that it's in so it doesn't cause the firefox internal error if the div is hidden?

    thanks,
    chris

  •  05-03-2005, 2:10 PM 3932 in reply to 3895

    Re: showing/hiding in firefox causes problems with freetextbox

    I'm having the same problem on a project I've been working on, so I can confirm that it is a problem.  Chris I haven't found a way to get around it yet, but I'll keep trying.  Let me know if you come up with anything else.

    Thanks,
    Brad
  •  05-03-2005, 2:25 PM 3933 in reply to 3932

    Re: showing/hiding in firefox causes problems with freetextbox

    One other thing I forgot to mention,

    FTB works great if it is shown first, but if I change it to display: hidden and back to display: block it starts to have issues again.  The error code firefox gives is this:

    Error: uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIDOMNSHTMLDocument.queryCommandValue]"  nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"  location: "JS frame :: http://localhost/ContentManager35/web/articles/FtbWebResource.axd?a=FreeTextBox%2c+Version%3d3.0.3300.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d5962a4e684a48b87&r=FreeTextBoxControls.Resources.JavaScript.FTB-FreeTextBox.js&t=632503011061216550 :: anonymous :: line 725"  data: no]

    I'm guessing this will take a javascript change to make things work, and is not something an external hack could effect.  Although maybe you could leave it as display: block and only have it be 1x1 px or so...
  •  06-16-2005, 11:47 AM 4325 in reply to 3895

    Re: showing/hiding in firefox causes problems with freetextbox

    I just ran into this exact same problem as well. Does anyone have a solution/workaround or any word from the developer(s) as to when this could be fixed? Thanks!
  •  12-14-2005, 4:30 PM 5375 in reply to 3895

    Re: showing/hiding in firefox causes problems with freetextbox

    Has anyone come up with a work-around for this yet?

    I have multiple FTBs in one div tag so it would make it difficult to "reset" the GoToHTMLMode() for each one.

    Any help is greatly appreciated!

    Thanks,
    Chad

  •  09-29-2006, 1:45 AM 7300 in reply to 3895

    Re: showing/hiding in firefox causes problems with freetextbox

    Going to bump this back up.
    I'm having the same problem and was wondering if there was a workaround/fix yet.

    Thanks!
    -Duster
  •  09-22-2007, 1:33 AM 8557 in reply to 7300

    Re: showing/hiding in firefox causes problems with freetextbox

    bumping this one up again too. I have the same issue. Anyone with fixes or good hacks ?
  •  10-11-2007, 3:26 PM 8601 in reply to 3895

    Re: showing/hiding in firefox causes problems with freetextbox

    I'm having the same problem. I have a few comments to add:

    Fails only when the page loads with FTB's parent style set to DISPLAY: NONE

    If you set Visibility: Hidden, it works fine, but, this is not the desired effect since it leaves a huge hole in the middle of the page.

    Any help with this?

  •  10-11-2007, 3:32 PM 8602 in reply to 8601

    Re: showing/hiding in firefox causes problems with freetextbox

    BTW, This problem is still happening with the newest version 3.1.6 Pro
  •  10-11-2007, 3:39 PM 8603 in reply to 8602

    Re: showing/hiding in firefox causes problems with freetextbox

    The Error is in the DLL:

    Me.Page.RegisterOnSubmitStatement((Me.ClientID & "_OnSubmit"), ("FTB_API['" & Me.ClientID & "'].StoreHtml();"))

    This is not testing to see if FTB_API[ClientID] is actually an object before using it, I think you could get around it with a little JavaScript hackery, but it really needs to be fixed in FreeTextBox.dll.

    If I come up with a solution, I will post it here...
  •  10-11-2007, 4:22 PM 8604 in reply to 8603

    Re: showing/hiding in firefox causes problems with freetextbox

    Ok, I "fixed" the problem with the following very nasty hack:

    // find registered submit function
    var ftbSubmit=document.forms[0].onsubmit;
    if (typeof(ftbSubmit) == 'function'){
        document.forms[0].onsubmit = function(){
            try{ftbSubmit();}
            catch(ex){}
        }
    }

    This code assumes that if there is an "onsubmit" event for the default form (index zero), it is FTB. I re-called the same function, but stuck in a try-catch to ignore the errors it causes. This is a very bad hack, and I dont recommend using it unless you must.

    The FTB developers really need to fix this internally in the code..

    HTH,
    Jeremy
  •  05-12-2008, 5:42 PM 9147 in reply to 3895

    Re: showing/hiding in firefox causes problems with freetextbox

    Yet another request for a bug fix for this issue from FTB. Is anyone listening??? This issue was first reported in 2005!!!

    Paying customer here, and I really need this to work. Being able to hide/show the editor is a key feature of the CMS product we're trying to build for clients. If I can't get it to work without an ugly hack, I'm going ot switch back to one of the other editors.

    Thanks.
  •  05-24-2008, 11:32 AM 9179 in reply to 9147

    Re: showing/hiding in firefox causes problems with freetextbox

  •  10-22-2008, 3:17 PM 9544 in reply to 9179

    Re: showing/hiding in firefox causes problems with freetextbox

    this works in FireFox 3.0.3

    add this.Focus(); on the second line.

        if (FTB_Browser.isGecko) {
        this.Focus();
            this.designEditor.document.designMode = 'On';
            this.designEditor.document.execCommand("useCSS", false, true);
        }

View as RSS news feed in XML
www.freetextbox.com