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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import text file from client to list

Status
Not open for further replies.

ejg

Programmer
Aug 17, 2001
19
US
Hi Folks,

I am looking for some help importing values from a text file on a client machine into a list within an asp page. For example.....I have some functionallity that allows the user to add values one at a time to a list.....(via javascript) my problem is that the user may have as many as 500 - 2000 items to type in. I would like the user to import the values from the file or cut and paste the values from the file into the list array.

See current code that allows individual add's to the list.

any replies are greatly appreciated!

regards,
ejg
---------------------------------------

<HEAD>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

function move(fbox,tbox) {
var i = 0;
if(fbox.value != &quot;&quot;) {
var no = new Option();
no.value = fbox.value;
no.text = fbox.value;
no.selected = true
tbox.options[tbox.options.length] = no;
fbox.value = &quot;&quot;;
}
}
function remove(box) {
for(var i=0; i<box.options.length; i++) {
if(box.options.selected && box.options != &quot;&quot;) {
box.options.value = &quot;&quot;;
box.options.text = &quot;&quot;;
}
}
BumpUp(box);
}
function BumpUp(abox) {
for(var i = 0; i < abox.options.length; i++) {
if(abox.options.value == &quot;&quot;) {
for(var j = i; j < abox.options.length - 1; j++) {
abox.options[j].value = abox.options[j + 1].value;
abox.options[j].text = abox.options[j + 1].text;
}
var ln = i;
break;
}
}
if(ln < abox.options.length) {
abox.options.length -= 1;
BumpUp(abox);
}
}
function Moveup(dbox) {
for(var i = 0; i < dbox.options.length; i++) {
if (dbox.options.selected && dbox.options != &quot;&quot; && dbox.options != dbox.options[0]) {
var tmpval = dbox.options.value;
var tmpval2 = dbox.options.text;
dbox.options.value = dbox.options[i - 1].value;
dbox.options.text = dbox.options[i - 1].text
dbox.options[i-1].value = tmpval;
dbox.options[i-1].text = tmpval2;
}
}
}

function Movedown(ebox) {
for(var i = 0; i < ebox.options.length; i++) {
if (ebox.options.selected && ebox.options != &quot;&quot; && ebox.options[i+1] != ebox.options[ebox.options.length]) {
var tmpval = ebox.options.value;
var tmpval2 = ebox.options.text;
ebox.options.value = ebox.options[i+1].value;
ebox.options.text = ebox.options[i+1].text
ebox.options[i+1].value = tmpval;
ebox.options[i+1].text = tmpval2;
}
}
}

// End -->
</script>

</HEAD>



<BODY>

<form action=&quot;devcry1.asp&quot; method=&quot;POST&quot; name=&quot;parmform&quot;>
<table>
<tr>
<td>
<input type=&quot;text&quot; name=&quot;list1&quot; value=&quot;&quot;>
</td>
<td>
<input type=&quot;button&quot; value=&quot;Add&quot; onclick=&quot;move(this.form.list1,this.form.P1)&quot; name=&quot;B1&quot;><br>
<input type=&quot;button&quot; value=&quot;Delete&quot; onclick=&quot;remove(this.form.P1)&quot; name=&quot;B2&quot;><br><br>
<input type=&quot;button&quot; value=&quot;Up&quot; onclick=&quot;Moveup(this.form.P1)&quot; name=&quot;B3&quot;><br>
<input type=&quot;button&quot; value=&quot;Down&quot; onclick=&quot;Movedown(this.form.P1)&quot; name=&quot;B4&quot;>
</td>
<td>
<select multiple size=7 name=&quot;P1&quot;>
The Value Specified is

<%Request.Form (&quot;P1&quot;)%>
</select>
</td>
</tr>
<td colspan=&quot;2&quot;>
<p align=&quot;center&quot;>
<input type=&quot;submit&quot; name=&quot;B5&quot; value=&quot;View Report&quot;>
</p>
</td>
</tr>
</table>
</form>

<p><center>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top