View Full Version : Pass Multiple Values - Reset/Clear Textarea

06-20-2006, 11:03 PM
After passing values, I cleared the form to start over and tried passing a new value but the previous values return with the new value. So basically I need the multiple values resetted? I hope that makes sense. Here's the code:

oldvalue = "";
function passText(passedvalue) {
if (passedvalue != "") {
var totalvalue = passedvalue+"\n"+oldvalue;
document.displayform.itemsbox.value = totalvalue;
oldvalue = document.displayform.itemsbox.value;


<form name="selectform">
<font face="Arial, Helvetica, Sans Serif" size="3"><b>Select an Item:</b></font><br>
<select name="dropdownbox" size=1>
<option value="">Make selection</option>
<option value="Item 1">Item 1</option>
<option value="Item 2">Item 2</option>
<option value="Item 3">Item 3</option>
<option value="Item 4">Item 4</option>
<option value="Item 5">Item 5</option>
<option value="Item 6">Item 6</option>
<input type=button value="Add to list" onClick="passText(this.form.dropdownbox.options[this.form.dropdownbox.selectedIndex].value);">

<form name="displayform" >
<font face="Arial, Helvetica, Sans Serif" size="3"><b>Items added to list:</b></font><br>
<textarea cols="40" rows="5" name="itemsbox" ></textarea>
<input type="reset" value="clear">

Any feedback/help appreciated.