How to validate barcode?

How to validate barcode?
I have a form where an admin will manually enter barcode of various products. I want to validate whether this code is in correct format or not. Is there any generic method to do this like validating Credit card numbers and SSN?

Best answer:

What do you mean by “manually enter”?

If you use a barcode scanner, the scanner will validate the code and will not accept anything not valid.

If they are just typing in the number, then it depends on which symbology of barcode they’re using. Code 128 has a checksum, but not Code 39. UPC/EAN has a check digit you must calculate.

So there’s no “generic” answer. You’ll need to find out which barcode symbology they’re using.

Tags: ,

Under Forum

Leave a Comment for How to validate barcode?

You must be logged in to post a comment.

Trackback this post  |  Subscribe to the comments via RSS Feed


Categories