views:

738

answers:

5

I have a problem with the FreeTextBox rich Text Editor in my ASP.NET site. The problem occurs when I access the site with firefox, and I have a freetextbox instance in a hidden div. The hidden div might also be an AJAX Tab Panel. The actual problem is that when the page loads it throws an uncaught exception (firebug shows the StoreHtml() function) and halts the postback!!

Is anywhere of the problem and a solution for it??

Thanks

A: 

Firefox has a problem with being inside anything with a style of display:none. What I did was to use a div with a zIndex that hid the div until I needed it displayed. I would start there.

A: 

Thanks for your answer, however my problem currently is that the FreeTextBox is inside an AJAX Tab Panel, therefore I would have to reconstruct the whole tab functionality in order to do so, and I do not have adequate time!

For what it's worth, I am close to a solution (I think) by setting the .ReadOnly attribute of the FTB to true and then setting it back to false on the controlo .PreRender. It works for the first time the page loads, so now I have to figure out how to implement this properly for every postback.

I will post the solution if I find it!

Thanks anyway!

Nikos Steiakakis
+1  A: 

I recently met a similar problem with jQuery UI tabs. What you need to do is to change the CSS for hidden tabs to something like:

.hiddentab
{
     position: absolute;
     left: -99999999999999;
}

This puts hidden tabs far to the left, and in absolute position mode this does not cause horizontal scroll bars to appear. When the tab is shown, simply remove the hiddentab class from the tab element.

This will work if the problem is related to Firefox' odd behavior with display: none.

Vegard Larsen
A: 

Thanks Vegard! Your answer works, but the problem is that now I have to change the styles for the tabs, whereas I wanted to find a workaround for the control in general. Anyway, I'm marking your answer as accepted since it gave one workaround!! Appreciate it!

Nikos Steiakakis
A: 

I have found another solution to the problem in case anyone is looking for it. What I did was use javascript to override the OnSubmit function of the form, thus catching the exception that caused the problem and going on with the rest of the code.

However the solution is kind of "hack" since it does not cover every situation. I found the solution in the FreeTextBox forum and tried it out and it works. The only difference in my code is that I return true in the end of the override function:

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

    // We are ok
    return true;
}

Since my site is an ASP.NET site I also had to add this line in the Page_Load():

ClientScript.RegisterOnSubmitStatement(this.GetType(), String.Concat(this.ClientID, "_OnSubmit"), "javascript: return OvrdSubmit();");

Hope it helps anyone with the same problem.

Nikos Steiakakis