Solved

dropdown menu to populate a textarea

Posted on 2008-06-11
5
724 Views
Last Modified: 2013-11-19
Hi Experts!

 I have a question realted to a dropdown menu which populates a textfield. I have the following code. The problem is the following:
I have 4 options in the dropdown menu. The textarea must be populated with only 2 selected options.
When I change the option from the dropdown it also changes in the textarea overwritting the previous selected one. I wanted that the first option selected is still there and the 2nd is added after the first one.
How this can be done?

Thank you in advance!
function select(source,dest) {

                var destFeld = document.getElementById(dest);

                destFeld.value = source.value;

    }

Open in new window

0
Comment
Question by:dlcnet
  • 3
  • 2
5 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 21762342
Like this:
function select(source,dest) {

                var destFeld = document.getElementById(dest);

                destFeld.value += source.value;

    }

Open in new window

0
 

Author Comment

by:dlcnet
ID: 21762390
@ Zvonko:
 Thanks! It works, but it adds the 2nd option after the 1rst one. I would like to have it on the next row.
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 21762409
Check this:
function select(source,dest) {

                var destFeld = document.getElementById(dest);

                destFeld.value += source.value+'\n';

    }

Open in new window

0
 

Author Comment

by:dlcnet
ID: 21762473

 @ Zvonko: Many thanks for the quick solution!
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 21762488
You are welcome.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now