Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


onchange question

onchange question

onchange question

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.


<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?

RE: onchange question

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?

RE: onchange question


  • You have to set onchange on the control, not the form. Changing this will possibly work.
  • onchange 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.
Of course, there are still the hard ways, to code the capturing and handling of events. But first I would try the above ones.


RE: onchange question

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.


---People Remember about 10% of what you say ---They never forget how you made them feel. Covey

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close