Hello,

I was wondering if it is possible to restrict the values of a text input box to only accept set values such as "XBC1". I am trying to make a form for a scanner so you can scan bar codes and it will auto fill the form out and have default values set so incorrect values cant be submitted into the database and mess everything up.

Another question i have is, is it possible to populate the input box with a java array.

Thank you for your time.

With javascript, you can use RegExp function with the onkeypress event.

Sounds like it will not be typed in with keyboard though?

Just figure out how/when to validate and use RegExp to do it.

I was wondering if it is possible to restrict the values of a text input box to only accept set values such as "XBC1". I am trying to make a form for a scanner so you can scan bar codes and it will auto fill the form out and have default values set so incorrect values cant be submitted into the database and mess everything up.

It's hard to see what the overall system architecture might be. I guess there must be some specialised scanner s/w to initiate/receive the scan, interpret it and pass the resulting string to a browser interface. Maybe modern scaners come with some sort of ActiveX control to make this kind of theing possible. My scanner is way too old for anything like that.

Another question i have is, is it possible to populate the input box with a java array.

Java or javascript? It's hard to see how Java might be relevant.

In javascript, a array of strings is easily converted to a single string with the Array.join() method (equivalent to PHP's implode()).

Airshow

It's hard to see what the overall system architecture might be. I guess there must be some specialised scanner s/w to initiate/receive the scan, interpret it and pass the resulting string to a browser interface. Maybe modern scaners come with some sort of ActiveX control to make this kind of theing possible. My scanner is way too old for anything like that.

the scanner is a new ikon model and takes care of the data input all by its self, pretty sweet stuff. The Java comes into play because i am coding this using a jsp page with a java bean to store the data and submit it to a database. i would use a drop down box for the selections but the drop down box searches by first letter and not by the full value.

Thinking out loud here ...

So has the scanner got an embeded web server? I know some do.

If so, then the browser sits between two servers - one in the scanner, and a conventional server (Apache/Tomcat presumably) which serves JSPs and interacts with the database via JEB.

With this sort of architecture there's at least one decision to be made with regard to what you want to do client-side (Javascript) and what you want to do server-side (Java/JSP) - namely your issue of data validation. Personally, I would do it server-side in java each time a scan is submitted. By using AJAX HTTP requests, you should be able to display feedback messages ("stored"/"rejected"/...) in the same web page without refreshing (which will be important to maintain communication with the scanner from a single browser window).

You've probably thought of all this yourself. I'm still trying to get a handle on the architecture.

Did the scanner come with a web interface for controlling it.
And in the documentation do they give any clues on customisation?

I don't get the point about drop down boxes searching by first letter and not by the full value? At what point would that be relevant to the scan/submit/store process?

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.