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

How to enter many entries through listbox & do a count before submit?

Status
Not open for further replies.

icy111

Programmer
Dec 13, 2001
39
US
Dear all,

Here is my scenario:
I am using an ASP form.
I have to enter many inputs/entries into a listbox, based on the number of entries, i need to display the counter in a text box.
All these steps need to be DONE before i click on the submit button.

Is there a way where i can enter thru' the listbox and count how many entries before i click on the submit button?

Or should i use a textarea or text box??

Thanks. I need help urgently.

Regards
icy111
 
>> I have to enter many inputs/entries into a listbox, based on the number of entries

OK, I'm a little confused as to where the entries come from - do you want the user to put them in manually, or do they come from your database? I'm assuming that it's automatically populated from your database - in which case, wouldn't you already know how many entries there were?

If you wanted the user to enter them manually, then where does the number of entries they have to enter come from?

>> Is there a way where i can enter thru' the listbox

Again, a little confused as to what you're asking. Do you want to be able to enter new entries directly into the list box?

>> count how many entries
[tt]document.YourFormName.YourSelectName.options.length[/tt] will return the number of entries.

>> Or should i use a textarea or text box??
For what? To display the count? - neither. If you just want to display something to the user, Use a span or div element. If you just need to submit the number back to the server without displaying it to the user, use a <input type=&quot;hidden&quot;>. However if you wanted the user to be able to edit the count before submitting the form, use a text box.

I hope this is some of what you're after. A more detailed problem description might enable someone to post a better answer.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Hi dwarfthrower

Sorry for the confusion.

>> I have to enter many inputs/entries into a listbox, based on the number of entries

Nope, there are not from database. User has to scan in mulptiple entries or manually enter infomation.


>> Is there a way where i can enter thru' the listbox

Yes, i want user to enter in the listbox.

>> count how many entries
document.YourFormName.YourSelectName.options.length will return the number of entries.

>> Or should i use a textarea or text box??

I wasn't sure should i use the 2 options or someother options where it allows me to do manually entering and scanning, and also, to calculate the number of entries.

Hope this clear your doubts.

Thanks for your response.



 
>> User has to scan in mulptiple entries
OK, that scares me some... what sort of scanner are we talking about here. Flatbed &quot;take a picture of a document&quot; type scanner or infrared barcode scanner?

>> or manually enter infomation.
That we can handle.

>> i want user to enter in the listbox.
Ok, as you've probably noticed, you can't actually edit what's in a list box directly. You'll need a routine to add the new entries in. That's easy:

[tt]document.getElementById('MyListBox').options[document.getElementById('MyListBox').options.length] = new Option(&quot;The New Option Text&quot;);[/tt]

>> to calculate the number of entries.
At any point in time we can easily get the number of entries. Don't worry about that.

>> allows me to do manually entering and scanning
Still need to find out what sort of scanning, you're talking about.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
sorry again...i didn't make yself clear.

Is a barcode scanner that i am referring to.


>> i want user to enter in the listbox.
Ok, as you've probably noticed, you can't actually edit what's in a list box directly. You'll need a routine to add the new entries in. That's easy:

document.getElementById('MyListBox').options[document.getElementById('MyListBox').options.length] = new Option(&quot;The New Option Text&quot;);

for the above javascript code you have provided. i need to call it onChange event? or some other event handler?

Thanks again for your help...:>
 
Hi dwarfthrower

I am going to change a bit of my HTML form, due to some requests. Still working in ASP.

I have added a textbox, so when a user manually enter/scan 1st barcode, it will go directly to the textbox.
When user scans the 2nd barcode, 1st barcode should go directly to the listbox.
When the 3rd barcode is being scanned, the 2nd will go to listbox as well. This goes on.
Once finish scanning, the listbox will contain the list of barcodes.
Based on the list, it will calculate the total number of items scanned and display in a textbox.

Hope this is clear enough for you to digest.

THanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top