Solved

dropdown menu to populate a textarea

Posted on 2008-06-11
5
730 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

628 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