Hidden FreeTextBox bug on Firefox

时光毁灭记忆、已成空白 提交于 2019-12-07 12:22:50

问题


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


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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!



来源:https://stackoverflow.com/questions/253490/hidden-freetextbox-bug-on-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!