Advanced HTML Editor Support Product Page
This topic is locked
This topic was archived
Update HTMLEdit field with JavaScript
Asked 25 Oct 2004 18:24:11
1
has this question
25 Oct 2004 18:24:11 John Pawson posted:
I am trying to get several fields on a main page automatically updated from child windows by changing the Value of the various fields using javascript (eg. opener.document.form1.field.value = "newvalue"This works for normal text fields but not for an HTMLEdit (v1.1.1) field.
I've seen a FAQ about this, but it isn't specific enough to answer the problem.
(I've just got the v2 upgrade but not installed it yet - will this make a difference?)
Thanks.
Edited by - jmpawson on 25 Oct 2004 19:07:13
Replies
Replied 27 Oct 2004 22:46:46
27 Oct 2004 22:46:46 Camillah Ringes replied:
Hmm, could you be more specific of what you 're trying to do?
The way that I understand it now is that you want to change the content from the HTML editor by javascript.
But do you want to add something or change the whole content?
The best way to get this to work is to call the content window by ID.
But before I go into details it would be nice if you post some more info.
In version 2 it's a quite compicated thing to do, because mozilla handles these kind off things 'a little' different then the IE does.
--------------------------------------------------
Camillah Ringes
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
The way that I understand it now is that you want to change the content from the HTML editor by javascript.
But do you want to add something or change the whole content?
The best way to get this to work is to call the content window by ID.
But before I go into details it would be nice if you post some more info.
In version 2 it's a quite compicated thing to do, because mozilla handles these kind off things 'a little' different then the IE does.
--------------------------------------------------
Camillah Ringes
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
Replied 28 Oct 2004 11:10:14
28 Oct 2004 11:10:14 John Pawson replied:
The main window has various fields in a form, including a drop-down and an AdvancedHTMLEdit Field. The user selects an option from the drop-down which causes a pop-up window to open with various details on. The user then clicks a button in the child window which replaces the value of the corresponding fields in the main window with those in the child window.
Hope that's clear!
Edited by - jmpawson on 28 Oct 2004 11:11:07
Hope that's clear!
Edited by - jmpawson on 28 Oct 2004 11:11:07
Replied 28 Oct 2004 23:51:47
28 Oct 2004 23:51:47 Camillah Ringes replied:
I'm sorry that I have to say that this isn't much clearer then you former post.
I do know a bit about DHTML and I just wanted to help you further.
As I just finished version 2 and the gallery addon I now have more time for support.
It may seem an unimported question, but it's quite important to know if you want to
change the whole content, or add something to it. Just changing everything in the
content window is quite simple and goes like this (it's a long line):
<pre id=code><font face=courier size=2 id=code>var objname ="theTextareaId";
window.opener.document.getElementById('_' + objname + '_editor').contentWindow.document.body.innerHTML = "newvalue";</font id=code></pre id=code>
When wanting to add something to the content it is getting a bit more complicated.
You have to get the range and insert a new node into the document. IE and mozilla
handle these kind of functions differently.
If you want to do use the above code with the version 1 editor you have to put an
extra attribute in the textarea tag defining the id. Be sure you name the id yhe same
way as the name attribute wich is already there. In version 2 the id gets inserted
automaticly. The above 'var objname' has to get the value of the id attribute.
Are you already a bit familiar with DHTML? For IE you can get good info at this site:
msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp
This site also contains a library where you can look up all functions and methods.
For gecko based browsers this site is recommendable:
www.mozilla.org/docs/dom/domref/dom_shortTOC.html
It's not as detailed as the microsoftsite but it has a nice overview of all the things
and functions needed for coding for gecko (mozilla)
Hope this helps you out.
P.S. English is not my native language, that's why my posts can look sometimes
a bit briefly and 'unkind', but it's deffenatly not mented in that way.
Regards,
--------------------------------------------------
Camillah Ringes
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
I do know a bit about DHTML and I just wanted to help you further.
As I just finished version 2 and the gallery addon I now have more time for support.
It may seem an unimported question, but it's quite important to know if you want to
change the whole content, or add something to it. Just changing everything in the
content window is quite simple and goes like this (it's a long line):
<pre id=code><font face=courier size=2 id=code>var objname ="theTextareaId";
window.opener.document.getElementById('_' + objname + '_editor').contentWindow.document.body.innerHTML = "newvalue";</font id=code></pre id=code>
When wanting to add something to the content it is getting a bit more complicated.
You have to get the range and insert a new node into the document. IE and mozilla
handle these kind of functions differently.
If you want to do use the above code with the version 1 editor you have to put an
extra attribute in the textarea tag defining the id. Be sure you name the id yhe same
way as the name attribute wich is already there. In version 2 the id gets inserted
automaticly. The above 'var objname' has to get the value of the id attribute.
Are you already a bit familiar with DHTML? For IE you can get good info at this site:
msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp
This site also contains a library where you can look up all functions and methods.
For gecko based browsers this site is recommendable:
www.mozilla.org/docs/dom/domref/dom_shortTOC.html
It's not as detailed as the microsoftsite but it has a nice overview of all the things
and functions needed for coding for gecko (mozilla)
Hope this helps you out.
P.S. English is not my native language, that's why my posts can look sometimes
a bit briefly and 'unkind', but it's deffenatly not mented in that way.
Regards,
--------------------------------------------------
Camillah Ringes
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
Replied 30 Oct 2004 12:44:30
30 Oct 2004 12:44:30 John Pawson replied:
That's <font color=red>BRILLIANT</font id=red>
Thanks so much for your help, and for the really helpful link to MSDN.
Your postings (and your English) are clear and easy to understand!
I've installed v2.02 and it seems to be stable.<img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Thanks so much for your help, and for the really helpful link to MSDN.
Your postings (and your English) are clear and easy to understand!
I've installed v2.02 and it seems to be stable.<img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
