Advanced HTML Editor 2 Support Product Page
This topic was archived
Copy value from a drop down to html editor
Asked 07 May 2005 02:36:02
1
has this question
07 May 2005 02:36:02 Alejandro Mucino posted:
I managed to create a JavaScript that will copy whatever is selected from a drop down into a text box, maintaining whatever has been typed before the
selection is made. So far, so good. This is the code, you can actually
copy/paste to a blank ASP page and test it.
<select name="s"
size="1" class="bodytext" onChange="document.form1.state.value =
document.form1.state.value+document.form1.s.options[document.form1.s.selectedIndex].value">
<option value=" "></option>
<option value="[Alien:FirstNm]">Alien - First
Name</option>
<option value="[Alien:LastNm]">Alien - Last Name</option>
</select>
You will need a form though.
Now, this is the problem. Instead of copying it to a text field I need it to
copy to the Advanced HTML Editor Box. the box ID is "editor1", I changed the
field 'state' to 'editor1' but this did not work, the text is not copied
over the html editor .... I was wondering if you know how to do this with the html editor, I tried some stuff some people proposed but did not help, since its your extension you might be able to tell me how to do it.
Thanks,
Alejandro
Replies
Replied 09 May 2005 13:20:20
09 May 2005 13:20:20 Leonard Louwe Kooijmans replied:
try this :
onChange="dmxedit_insertHTML("editor1",document.form1.state.value+document.form1.s.options[document.form1.s.selectedIndex].value);
Code will be inserted on cursor's position.
-------------------------------------------------------------------------
80% of the requirements take 20% of the time to develop...
onChange="dmxedit_insertHTML("editor1",document.form1.state.value+document.form1.s.options[document.form1.s.selectedIndex].value);
Code will be inserted on cursor's position.
-------------------------------------------------------------------------
80% of the requirements take 20% of the time to develop...
Replied 09 May 2005 13:41:29
09 May 2005 13:41:29 Alejandro Mucino replied:
I appreciate the help, but all it gives me is a syntax error.
Replied 09 May 2005 16:20:56
09 May 2005 16:20:56 Leonard Louwe Kooijmans replied:
My bad, should have used single quotes around editor1 instead of double. But if you had some more advanced javascript knowledge you would have spotted that:
onChange="dmxedit_insertHTML('editor1',document.form1.state.value+document.form1.s.options[document.form1.s.selectedIndex].value);"
-------------------------------------------------------------------------
80% of the requirements take 20% of the time to develop...
onChange="dmxedit_insertHTML('editor1',document.form1.state.value+document.form1.s.options[document.form1.s.selectedIndex].value);"
-------------------------------------------------------------------------
80% of the requirements take 20% of the time to develop...
Replied 09 May 2005 16:43:49
09 May 2005 16:43:49 Alejandro Mucino replied:
Thanks!