473,594 Members | 3,008 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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....Wher e 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="javas cript">
function getit(){
var data='...\n';
if(data.value){
data=document.f orm1.sel1.optio ns[document.form1. sel1.SelectedIn dex].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>Resolutio n: </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 4888

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....Wher e 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.f rm.sel1.options[document.frm.se l1.SelectedInde x].value+"....\n" ;
}
document.frm.te x1.value=data;
}
=============== ===========
This code does not give an error, but it does not work also, only
getting .....in the textarea......
=============== ===========
<html>
<head>
<script language="javas cript">
function getit(){
var data='...\n';
if(data.value){
data=document.f orm1.sel1.optio ns[document.form1. sel1.SelectedIn dex].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>Resolutio n: </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.t ex1.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
17998
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 function and have JS put this into an array. Then JS would use this array to create a selection list which displays only the names of the drugs. When the user selections one of the drugs, another selection list will be loaded with the avaiable...
4
11185
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 (for lack of a better term) value in a TextArea element ie. {TITLE}. this works: <input readonly="true" value="{TITLE}" name="titleedit" size="50" maxlength="255" class="detaileditentry">
2
4530
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 is just data I dont have to write EncType as it picks the default one. But to use the second one that is to upload an image. I need to write EncType = "multipart/form-data". When I do this the text passed from the other text field goes blank.
19
6871
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 JavaScript in this code from a couple different sites but I'm not 100% sure what each line is doing...This is the ASP code that I'm using for the page....Take a look at the JavaScript code and please let me know what each line is doing....I have been...
14
2945
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 internet, and there is obviously some naming or reference issue that I can't get my head around. Here is my code: import java.awt.*; import java.awt.Font; import java.awt.Graphics; import java.awt.FontMetrics; import java.io.*; import java.net.*;...
4
2918
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 text and I can't find the error on why it isn't working. Any help is greatly appreciated. Here is the form
4
2738
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 file and keep that text in the specific text area even after i closed it and then i would like to hold that same text in the text Area after i have opened it and my clear button doesnt seem to clear the specific field i am asking it to clear any...
9
2115
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 the file, the file is not shown '"\, it shows \'\"\\, Why the file was added in this symbol \ inside my file? This will not happen if i didn't key in these three symbols.
0
7947
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8255
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8010
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6665
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5413
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.