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

onchange question

Status
Not open for further replies.

penguinspeaks

Technical User
Nov 13, 2002
234
0
16
US
Once again you all have come to my rescue so I am back.

Let me explain what I need. I have a barcode scanner that scans the number into whatever field the curser is in when the scanning takes place.
What I want to do is as soon as the scan takes place, and the field is populated, submit the form.
The onchange does not do this or is it even suppost to? I have read that this is mor for dropdown menus than regular texxt fields.
Code:
<form action="shippingasp.asp" onchange="this.form.submit()" method="post" name="sform1">

This is what I have but it does not submit automatically when the field receives data. Is there a function of some sort that can accomplish what should happen here?
 
Or, if this is not possible, is it possible to autosubmit when a certain character amount has been reached?

The labels I will be scanning have 9 digits in them. So can I, if my original question cannot be done, have it submit because 9 charactera have been put into the field?
 
Hi

[ul]
[li]You have to set [tt]onchange[/tt] on the control, not the [tt]form[/tt]. Changing this will possibly work.[/li]
[li][tt]onchange[/tt] is triggered when the control loses focus, if modifications were made since it received the focus. If you can configure the barcode reader to send a tab character instead of the default new line character after the read data, will probably work.[/li]
[/ul]

Of course, there are still the hard ways, to code the capturing and handling of events. But first I would try the above ones.


Feherke.
feherke.ga
 
Hi Bam, my company uses Code 39 standard scanners on some of our pages. Every one I've worked with sends a carriage return (ASCII 13) at the end of the scanned code. The problem I've always had to code around is NOT submitting the form after a scan since the CR, by default, submits the form if there is a submit type element on the form. If I understand your question, it sounds like the default behavior is what you are after.

Does your scanner send a CR at the end of each character string? (just scan something in a word processor and see if the cursor winds up on the next line)

Try a placing a submit element in your form and see if the scanner fires it for you without modifying any of your onchange events.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top