Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mort Reddov on Apr 30, 2009 06:47
open dhtmlx forum
dhtmlXeditor: not working when hidden initially

I'm trying to use dhtmlXeditor in a way similar to dhtmlXCalendar:

Initially, the editor is hidden.
Whenever a user clicks a button, it is shown and ready to be used.
I've tried various ways but could not get it to work.
Extracts from my source:


<script type="text/javascript" language="JavaScript">
function doInitEditor() {
editor = new dhtmlXEditor("first_intraday", "standard");
editor.setIconsPath(image_path);
editor.init();
$("first_intraday").hide();
}
</script>

<span id="region_of_first_intraday" onclick="$('first_intraday').toggle()"></span>
<div id="first_intraday"></div>

<script type="text/javascript" language="JavaScript">
doInitEditor();
</script>


Firebug throws the following error when I left-click in the editor:


[Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsISelection.getRangeAt]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://...:8081/ReconcileFiveR4/assets/js/dhtmlxeditor.js :: anonymous :: line 26" data: no]
http://...:8081/ReconcileFiveR4/assets/js/dhtmlxeditor.js
Line 26


I'm using dhtmlxeditor.js v.2.0 build 81107
Thanks in advance.
Answer posted by Alex (support) on Apr 30, 2009 07:38

We have tested this mode with the latest editor version - teh sample is attached.

Please, provide the sample that demonstrates the issue.

Attachments (1)
Answer posted by Mort Reddov on Apr 30, 2009 08:22
I tested your sample with the following results:

Using IEv6, it works fine.
With FF 3.0.10 however, it is only working when the "hide" link is not being clicked.
After clicking "show", it is no more possible to edit text in the editor "window".

However, my bigger concern is that when I uncomment the call for function "hide()" and than run your sample code,
the editor is neither working in IEv6 nor in FF3.

<script>
    var editor = new dhtmlXEditor("editorObj");
    editor.setIconsPath("codebase/imgs/");
    editor.init();
    hide();
    function show(){
        document.getElementById("editorObj").style.display = "";
    }
    function hide(){
        document.getElementById("editorObj").style.display = "none";
    }
</script>

Thanks for your quick reply!
Mort.
Answer posted by Alex (support) on Apr 30, 2009 08:55

The issue is confirmed.

As the possible workaround you can try to reinitialize editor each time you show it.

Please, see attached sample.

Attachments (1)
Answer posted by Mort Reddov on Apr 30, 2009 11:02
The workaround works...

In IEv6, all is good.
In FF 3.0.10, it looks like the browser tab is being reloaded everytime the editor is shown / initialized.

Thanks for the quick fix.