This topic is locked

Dropdown OnClick Event

3/17/2009 6:42:25 AM
ASPRunnerPro General questions
H
HilcrRWise author

I am using the following code in an ASP Snippet to create a dropdown box on my Edit page:

categories_list = "<select style=""width:450px""><option value=""CommentBank"">Comment Bank</option>"

str = "Select Statement, Statement2 From SBank_tbl"

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection

while not rstmp.eof

categories_list = categories_list & "<option value="""" Title=""" & rstmp("Statement") & rstmp("Statement2") & """>" & rstmp("Statement") & rstmp("Statement2") & "</option>"

rstmp.MoveNext

wend

rstmp.close

set rstmp=nothing

Response.write categories_list & "</select>"


I now want to add an OnClick event to this code so when I click on a value from the dropdown box that value will be copied on to the end of the text already entered in to another field (field is a textarea called 'Comment').
How can I modify the code to achieve this?
Thanks

J
Jane 3/17/2009

Richard,
you can add your onclide event in the <select> tag directly.

Here is just a sample:

<select style=""width:450px"" onclick=""document.forms.editform.value_FieldName.value=this.options[this.selectedInd

ex].value;"">