• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Javascript question

LEGEND ,
Oct 17, 2006 Oct 17, 2006

Copy link to clipboard

Copied

I have been searching for the last 2 day for a javascript function that
someone told me about. I am trying to populate a select field, set to list,
with uploaded values. What I need to do is when the user clicks on the item
in the list, the value is inserted into a textarea. This is where the
javascript comes in, I guess.

Does anyone know what that would be called so I can look for it on
Blingo/Google?

Thanks


TOPICS
Advanced techniques

Views

246

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 17, 2006 Oct 17, 2006

Copy link to clipboard

Copied

for your select, add an attibute like this:

onclick="otherfield.value=this.value;"

The syntax might not be correct but the general idea is.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 17, 2006 Oct 17, 2006

Copy link to clipboard

Copied

Try this:

<script type="text/javascript">
<!--
function fillText() {
var Current =
document.myForm.mySelect.selectedIndex;
document.myForm.myText.value =
document.myForm.mySelect.options[Current].value;
}
//-->
</script>

<form id="myForm" name="myForm">
<select id="mySelect" name="mySelect" onchange="fillText()">
<option value="">--none--</option>
<option value="2.50">alpha</option>
<option value="1.95">beta</option>
<option value="3.00">gamma</option>
</select>
<input id="myText" name="myText" type="text">
</form>


--
Ken Ford
Adobe Community Expert
Fordwebs, LLC
http://www.fordwebs.com


"Wally Kolcz" <wkolcz@softproofs.com> wrote in message
news:eh2fji$1ot$1@forums.macromedia.com...
>I have been searching for the last 2 day for a javascript function that
>someone told me about. I am trying to populate a select field, set to list,
>with uploaded values. What I need to do is when the user clicks on the item
>in the list, the value is inserted into a textarea. This is where the
>javascript comes in, I guess.
>
> Does anyone know what that would be called so I can look for it on
> Blingo/Google?
>
> Thanks
>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 19, 2006 Oct 19, 2006

Copy link to clipboard

Copied

LATEST
The script works great in autofilling the text area with the value of the
drop down.
What I need to do is to be able to insert items from the list into a text
area with a double click.
How can I modify that to target my textarea ('html') and only add the item
to the textarea?

Thanks!


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation