Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Multiple submit buttons, barcode scanner and enter key

843841Aug 9 2003 — edited Aug 10 2003
I'm new to web programming and a bit over my head with a project at work (programmer resigned without notice last month).

I'm designing a web page for a servlet based web application for a library catalogue system where i work. The page i'm working on uses three forms, one for each "session" (ie multiple tasks using same web page). The last form on the page has the following features:

A form with 15 text input fields and 3 submit buttons
type =submit name=submit value=reset
type =submit name=submit value=delete
type =submit name=submit value=add/change

The servlet uses the value to determine how to process the form data.

The last input field on this form is used to scan item numbers using a barcode scanner. My problem is the scanner always adds a return/enter character at the end of the item number which submits the form. The problem is the servlet gets confused and doesn't know which name/value pair to use to determine how to process the form data.

I've found a way to supress the enter character using javascript. The user can now scan the barcode, but they still have to click the "add/change" button to submit the form. The users of the sytem (who process hundreds of items in a batch) want to be able to scan the item number and have the "add/change" form button activated automatically. Is this possible using javascript events alone? I don't have any control over how the servlet works aat this stage. My script to supress the enter character from the scanner is below.

<script type="text/javascript"><!--
function noenter() {
return !(window.event && window.event.keyCode == 13); }
//--></script>

<input type="text" name="itemNumber" value="$LAST.itid" onkeypress="return noenter()">

My workplace only uses Internet Explorer and this web application is for internal use only.

I think the logic in the servlet goes like this:

If session status=3 //ie form that uses a scanner for last field variable=getParameter("submit")
If variable="reset"
process reset
Else if variable="delete"
process delete
else
process add/change


Sorry this is such a long question but the project is 12 months late and i'm the last man standing so to say.

Thanks in advance
Dominic
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2003
Added on Aug 9 2003
2 comments
444 views