Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Copy value of drop down menu into HTML editor

I have a drop down menu which shows the name of a draft and the value is the email draft itself.
Below I have an HTML Editor.
I need to be able to select an option from the drop down menu and have the value be copied over the the HTML editor. This way the user can select an 'email draft' which when selected will be copied over to the HTML editor.

this is the code for my drop down menu:

<select name="draft" class="form-control-yellow m-b" id="draft">
                    <option value="">Please select a draft</option>
                    <%
While (NOT rs_emaildrafts.EOF)
%>
                    <option value="<%=(rs_emaildrafts.Fields.Item("LetterId").Value)%>"><%=(rs_emaildrafts.Fields.Item("LtrName").Value)%></option>
                    <%
  rs_emaildrafts.MoveNext()
Wend
If (rs_emaildrafts.CursorType > 0) Then
  rs_emaildrafts.MoveFirst
Else
  rs_emaildrafts.Requery
End If
%>
                  </select>

Open in new window


This is the code for the HTML Editor I am using:

    <%   
               // Create Editor instance and use Text property to load content into the RTE.  
Dim rte
Set rte=new RichTextEditor   

' Show the value in this line below it recordset is not empty, otherwise value should be = ""
rte.Text=""
   rte.Text = rs_lttrmrg.Fields.Item("LtrBody").Value
				// Set a unique ID to Editor   
                rte.ID="editor1"  
				rte.Width="100%"  
				rte.Toolbar="bluedot"
				rte.MaxTextLength=8000
                rte.MvcInit()   
                // Render Editor 
                Response.Write(rte.GetString())  
            %>

Open in new window


To give the default value to the editor I for example could use:
This is an example of how the editor can get a value from an external source

rte.Text = rs_lttrmrg.Fields.Item("LtrBody").Value

In this case a recordset but it would need to be changed so it takes the value from the drop down menu instead.
Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)
Flag of United States of America image

Are you wanting to do this via postback or using client side like JavaScript / JQuery?
Avatar of Aleks

ASKER

Hopefully client side. I think it's better correct ?
Given the nature of what you want to do, yes, client side would be ideal.  Can you show us the HTML for the editor?
Avatar of Aleks

ASKER

The only code in the page is the above. The rest of the code are include files.
ASKER CERTIFIED SOLUTION
Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Ok, let me give it a try and let you know the results.

This is the editor I am using

http://asp.richtexteditor.com/
Avatar of Aleks

ASKER

I added the generic code and modified to fit the names of the fields but unfortunately it did not work.
page.txt
Avatar of Aleks

ASKER

I also tried something like:

 <select name="draft" class="form-control-yellow m-b" id="draft" onChange="('editor1',document.form1.draft.options[document.form1.draft.selectedIndex].value)">
                    <option value="">Please select a draft</option>
                    <%
While (NOT rs_emaildrafts.EOF)
%>
                    <option value="<%=(rs_emaildrafts.Fields.Item("LetterId").Value)%>"><%=(rs_emaildrafts.Fields.Item("LtrName").Value)%></option>
                    <%
  rs_emaildrafts.MoveNext()
Wend
If (rs_emaildrafts.CursorType > 0) Then
  rs_emaildrafts.MoveFirst
Else
  rs_emaildrafts.Requery
End If
%>
                  </select>

Open in new window


But it still doesn't copy the value to the editor.
Any other ideas ?
Avatar of Aleks

ASKER

I ended up adding the drop down in the previous page so that it posts the data to the next page.
Avatar of Aleks

ASKER

I've requested that this question be closed as follows:

Accepted answer: 0 points for amucinobluedot's comment #a41493008

for the following reason:

No solution that work was provided