Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy selected values from list into input field

Status
Not open for further replies.

ajoo

Programmer
Jun 26, 2008
3
Hi,
I need to write a java script: Here is what it should do, when user will click on the add button it will copy the add the selected value into input field seperated by comma(,). If the input field already has some name the selected name(s) will be added to the existing value of input field
Thanks

<html>
<head>
<title>Test</title>

</head>

<body>

<tr>
<td><strong>name</strong></td>
<td colspan="3"><input type="text" size="50" name="fName" value=""/></td>

<td colspan="3">
<INPUT TYPE=BUTTON VALUE="Add &lt;&lt" ONCLICK="copySelectedOptions('UserList')">
</td>
<td>
<SELECT MULTIPLE="MULTIPLE" NAME="UserList" SIZE="5" WIDTH=100 id="UserList">
<OPTION value="abrahast">abrahast</OPTION>
<OPTION value="abreura">abreura</OPTION>
<OPTION value="chris">chris</OPTION>
<OPTION value="john">john</OPTION>
<OPTION value="Ravi Tandon">Ravi Tandon</OPTION>

</SELECT>

</td>
</tr>
<br>
<br>
<br>
<tr>
<td>
<input type="button" name="B2" value="Save" onClick="test()">

</td>
</tr>
</body>
</html>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top