text file data into textarea

J

Junoon

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,
 
P

petermichaux

Junoon said:
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();">
 
J

Junoon

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>
 
J

Junoon

Just to let you know, was previously getting a message....

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top