By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,566 Members | 1,664 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,566 IT Pros & Developers. It's quick & easy.

List of options for textarea using javascript

P: 7
I have a need to create a list in a textarea, some selected by clicking on a word, some typed in by user. I have tried many things to little avail. I can set the text in the texarea, but it will not create a list nor add new items to the list. Anyone got any ideas?
Dec 20 '05 #1
Share this Question
Share on Google+
7 Replies


Expert Mod 100+
P: 2,330
Can you show us a link to an example form that uses what you want? I am not sure what you mean by list in a text area?
Dec 20 '05 #2

P: 7
I haven't found one. I am thinking it might can be done using javascript, simulating writing to the textarea.
Basically, I will have a table with a textarea in one cell, and single word selections in the other cells whose values can be added to the textarea if the user clicks on it.
If they do not like the selections, they have the option to type in other single words of their own choosing at the bottom of the textarea.
Dec 20 '05 #3

Expert Mod 100+
P: 2,330
haha, ah yes . . that is doable. You got me worried for a sec. I thought is this person asking to have a list inside the text area.

A good example of this is right in the forms of thescripts.com If you click on "Go Advanced" button in the quick reply form you will notice a bunch of smiley's and link buttons around the box. If you click on one, it will add stuff to the text area.

You are right you will need to use javascript.

Here is a good tutorial to start out, it might not do exactly what you want but the concept it very similar. The information might help you figure it out.

Add text to textarea or text field
Dec 21 '05 #4

P: 7
Thanks for your response. Actually, you had it right the first time, though. I am trying to create a list in a text area. I saw your example early in the search and it might work, but they also want to be able to choose from a visual table some set terms, as well as write some terms. It is kind of a hybrid selection and textarea box.

I may need to go with the example you have provided as it may be another user "unicorn" that would fly like a stone anyway, but I thought I would try.



haha, ah yes . . that is doable. You got me worried for a sec. I thought is this person asking to have a list inside the text area.

A good example of this is right in the forms of thescripts.com If you click on "Go Advanced" button in the quick reply form you will notice a bunch of smiley's and link buttons around the box. If you click on one, it will add stuff to the text area.

You are right you will need to use javascript.

Here is a good tutorial to start out, it might not do exactly what you want but the concept it very similar. The information might help you figure it out.

Add text to textarea or text field
Dec 21 '05 #5

P: 7
:p
Hey, you are right, the one with the emoticons does just what I need it to do!
I was looking at the selection box you have on another page.
How is that set up?

haha, ah yes . . that is doable. You got me worried for a sec. I thought is this person asking to have a list inside the text area.

A good example of this is right in the forms of thescripts.com If you click on "Go Advanced" button in the quick reply form you will notice a bunch of smiley's and link buttons around the box. If you click on one, it will add stuff to the text area.

You are right you will need to use javascript.

Here is a good tutorial to start out, it might not do exactly what you want but the concept it very similar. The information might help you figure it out.

Add text to textarea or text field
Dec 21 '05 #6

Expert Mod 100+
P: 2,330
I believe it's an onclick event that adds the data to the form via javascript. So "OnClick" image of smiley, smiley text is added to text area form.

These are the keywords i would search for in google: onclick, textarea, javacsript.

Keep us updated on what kind of solutions you run into.
Dec 21 '05 #7

P: 7
javascript:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <script language="javascript" type="text/javascript">
  3. function addtext(newtext) { 
  4.     document.myform.mytextarea.value = document.myform.mytextarea.value+= newtext;
  5. }
  6. </script>
HTML: Down in a table of "talents, skills, hobbies"
Expand|Select|Wrap|Line Numbers
  1.  <form name="myform"> 
  2. <table ...>
  3. <textarea name="mytextarea" cols=25 rows=15><talents></textarea>
  4. ....
  5. <A href="javascript:addtext('Fishing\r');">4-H</A>
  6.  
THANK YOU!
Dec 21 '05 #8

Post your reply

Sign in to post your reply or Sign up for a free account.