Aleks
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:
This is the code for the HTML Editor I am using:
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("Lt rBody").Va lue
In this case a recordset but it would need to be changed so it takes the value from the drop down menu instead.
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>
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())
%>
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("Lt
In this case a recordset but it would need to be changed so it takes the value from the drop down menu instead.
Are you wanting to do this via postback or using client side like JavaScript / JQuery?
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?
ASKER
The only code in the page is the above. The rest of the code are include files.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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/
This is the editor I am using
http://asp.richtexteditor.com/
ASKER
I added the generic code and modified to fit the names of the fields but unfortunately it did not work.
page.txt
page.txt
ASKER
I also tried something like:
But it still doesn't copy the value to the editor.
Any other ideas ?
<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>
But it still doesn't copy the value to the editor.
Any other ideas ?
ASKER
I ended up adding the drop down in the previous page so that it posts the data to the next page.
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
Accepted answer: 0 points for amucinobluedot's comment #a41493008
for the following reason:
No solution that work was provided