473,394 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

text file data into textarea

hi all,

I am trying to get the values of the item selected in a select list box
into a textarea, but the code is not working....Where am i going
wrong????

whenever i click on any item in the list, the corresponding value for
it will get displayed in the text area.....

Also, is there a way to get data from a text file into the textarea,
when i select an item in the list.

*****************************************
<html>
<head>
<script language="javascript">
function getit(){
var data='...\n';
if(data.value){
data=document.form1.sel1.options[document.form1.sel1.SelectedIndex].value+"....\n";

document.form1.tex1.value=data;
}
}

</script>
</head>

<body>
<form name="form1" onsubmit="getit(); return false">
<table>
<tr><td>Issue: </td>
<td><select name="sel1" size= "3">
<option value="pc problem">error 0680
<option value="modem problem">error 0633
<option value="network problem">error 0721
</select>
</td>
<td>Resolution: </td>
<td><textarea name="tex1" rows=7 cols=30 wrap=virtual></textarea>
</td>
</tr>

<TR>
<TD COLSPAN=2 ALIGN=center>
<INPUT TYPE=submit VALUE="Submit form"><BR>
<INPUT TYPE=reset>
</TD>
</TR>
</table>
</form>
</body>
</html>

Rgds,

Apr 1 '06 #1
3 4877

Junoon wrote:
hi all,

I am trying to get the values of the item selected in a select list box
into a textarea, but the code is not working....Where am i going
wrong????

whenever i click on any item in the list, the corresponding value for
it will get displayed in the text area.....
This sounds like it is already working. I assume that this is what you
want.
<form name="form1" onsubmit="getit(); return false">
<table>
<tr><td>Issue: </td>
<td><select name="sel1" size= "3">


I think you want something like this

<form name="form1">
<table>
<tr><td>Issue: </td>
<td><select name="sel1" size= "3" onchange="getit();">

Apr 1 '06 #2
Hi Peter,

tried the below code as you suggested. It does not give me an error but
it does not work also.

I was previously trying to use the This.form keyword in the getit()
function.....

like this.....
-------------------
function getit(frm){ ...................

and in the onChange event....
------------------------------------------
<td><select name="sel1" size= "3" onchange="getit(this.from);">

and change the statements in the function to ......
--------------------------------------------------------------------
data=document.frm.sel1.options[document.frm.sel1.SelectedIndex].value+"....\n";
}
document.frm.tex1.value=data;
}
==========================
This code does not give an error, but it does not work also, only
getting .....in the textarea......
==========================
<html>
<head>
<script language="javascript">
function getit(){
var data='...\n';
if(data.value){
data=document.form1.sel1.options[document.form1.sel1.SelectedIndex].value+"....\n";
}
document.form1.tex1.value=data;
}

</script>
</head>

<body>
<form name="form1">
<table>
<tr><td>Issue: </td>
<td><select name="sel1" size= "3" onchange="getit();">
<option value="pc problem">error 0680
<option value="modem problem">error 0633
<option value="network problem">error 0721
</select>
</td>
<td>Resolution: </td>
<td><textarea name="tex1" rows=7 cols=30 wrap=virtual></textarea>
</td>
</tr>

<TR>
<TD COLSPAN=2 ALIGN=center>
<INPUT TYPE=submit VALUE="Submit form"><BR>
<INPUT TYPE=reset>
</TD>
</TR>
</table>
</form>
</body>
</html>

Apr 2 '06 #3
Just to let you know, was previously getting a message....

"document.frm.tex1.value is Null or not an Object"

Apr 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Andrew V. Romero | last post by:
At work we have an excel file that contains the list of medications and their corresponding strengths. I would like to save the excel file as a text list and paste this list into a javascript...
4
by: dekern | last post by:
I have been trying to set the default text value of a TextArea element for about a day now without any luck. Similar to the code used to set the Text field below I would like to use the returned...
2
by: Lovely Angel For You | last post by:
Dear Friends Hope you all are doing great. I am using a form to add text data to the database. With this form I am also using a file field to upload a image file. To use the first thing that...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
14
jhardman
by: jhardman | last post by:
I am having a hard time opening a text file from an applet. I remembered after an attempt or two that there were obvious security issues here, so I switched the code to pull a text file off the...
4
cassbiz
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of...
4
by: Badboy112 | last post by:
Hi guys i have used a data file like you guys have asked me to but im not entirely sure how to use the DataInputStream What i would like to do for this assigment is import the text from the data...
9
by: qiqinuinaifen128 | last post by:
Hi Pro, I have a question i have an textarea for user to key in and a button for user to save what they key in into the textarea. if i key in '"\ in to textarea and i press the button save...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.