Page 1 of 1

How to make a dropdown box that adds text to a message box?

Posted: Sun Jun 04, 2006 5:36 pm
by lucas20042004
Hi, How would I make a dropdown list then select text from it and that would automatically be copied into a message box. See pic below:


Image

Posted: Sun Jun 04, 2006 6:02 pm
by Oren
You can't do that with PHP. Try javascript.

Posted: Sun Jun 04, 2006 6:03 pm
by lucas20042004
Anyone know how to do it with javascript then?

Posted: Sun Jun 04, 2006 7:35 pm
by Christopher
Something like:

Code: Select all

<script>
function setTextArea(obj) {
    document.myform.mytextarea.value = obj.value;
}
</script>
And for the form:

Code: Select all

<textarea id="mytextarea" ></textarea>
<form id="myform" >
<select onSelect="setTextArea(this)" >
...
</select>