Solved

dropdown menu to populate a textarea

Posted on 2008-06-11
5
723 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
Comment Utility
Like this:
function select(source,dest) {

                var destFeld = document.getElementById(dest);

                destFeld.value += source.value;

    }

Open in new window

0
 

Author Comment

by:dlcnet
Comment Utility
@ 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
Comment Utility
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
Comment Utility

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

Expert Comment

by:Zvonko
Comment Utility
You are welcome.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

743 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

16 Experts available now in Live!

Get 1:1 Help Now