Trigger move to new field when bar-code scanned - posible JavaScript method?

Posted on 2003-03-21
Medium Priority
Last Modified: 2013-12-18
I'm writing an application to scan bar-codes from backup tapes and then manipulate the tape details. Would like a batch method so I can scan the tapes in and perform the same operation on all tapes. Not sure how to go about having a dynamic field where as soon as it receives input (text from bar-code scanner) it reveals a new field, moves to that field and waits for another input.

Is this possible in LotusScrpt/JavaScript?
Question by:ChrisLeeMarshall
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

ID: 8180062
possible solution to have muti-value field.  The downfall of this is you are limited to the size of the field.  The alternate solution is

multifields in a single document (names all same but multiple occurances of the field with different content). The downfall of this method is while accessing the values referring to single field name and getting the specific value.  Its a mess and a little painful to play with this kind of document.  The alternative solution to this is to

have each document for each value.  Grrr the problem with this is you will have as many documents as you scan items.

Well thats how notes works though.

LVL 31

Expert Comment

ID: 8192633
You can use the onChange and FieldExisting events.

Author Comment

ID: 8193877
Sounds good - can you give me any code to help me along the way? not touched JavaScript at all yet!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 31

Accepted Solution

qwaletee earned 150 total points
ID: 8194658
That depends on whether you are using the Notes client or a web browser.

It all depends on how your bar code software fills the filed.  Ideally, whenit scans a code, it "types" the code in and then "hits" the tab key, which will trigger the LotusScript field existing event.  You can then put in code that does a doc refresh (to reveal conditional hidden fields) and then goes to the approprate field.  Or, it can type the bar code and hit F9, which will trigger the refresh, but not move the cursor (you can put LotusScript in the PostRecalc event to mov ethe cursor.

That all works in the Notes client.  If you are using the web browser, you don't have LotusScript.  Instead of a field existing event, you have onBlur().  But you won't need onBlur() because you have onChange(), which will detect the change ... but in most browser, this still depends on a field exit, again accomplished via the tab key.  The onChange event, by the way, exists in Domino Designer, but the Notes client doesn't fire it off in R5.  I have't tried R6 yet.

The LotusScript code would basically do NotesUiDOcument.fieldGetText for your field, and compare it to the previous value for the field (you can use a static string variable to do the compare).  If it has change, then execute the notesuidocument.refresh and notesuidocument.otofield.  You may want to validate the value before you do that as well.

IN JavaScript, use something like document.forms[0].FIELDNAME.value to get the value and validate it.  You would then probbably need to do a submit in order to let Domino process the change and reveal the appropriate hidden fields.  This can get tricky.  If you are using the GENERATE JAVASCRIPT option, you will have to figure out which object to simulate (you would probably need an action that says REFRESH, and then simulate a user clicking that action), and you would need the form onLoad event to dynamically figure our if it needs to move to the new field -- document.form.[0].NEWFIELDNAME.focus() would do this.
LVL 31

Expert Comment

ID: 8202651
By the way, I keep typing exiSting instead of exiting.  It should be the FieldExiting event.

I did think of one other thing you can do if the bar code program does not hit tab, F9, etc.

You can set a timer to look for the changes.  On teh Notes client, you would use the PostOpen event to record the original value in a global variable, and create a NotesTimer object.  The sub run by the timer object would have two variables -- one in which it retrieves the global value, the other to retrieve the current field value.  Then, it sets the global to the current value.  FInally, it compares its two internal variables, and if it is different, does processing (validation, NotesUiDocument.refreshHideFormulas and notesUiDocument.gotoField)

You can do something similar in the browser with setTimeOut.  Create a global JS variable in the JS header.  Set the value to document.forms[0].fieldname.value in the onLoad, followed by a setTimeOut.  The setTimeOut logic would be the same as described for the LotusScript sub.

Author Comment

ID: 8202961
Many thanks for the pointers. I've investigated software for the scanner and it looks like I will be able to get it to add a TAB or hit F9 in order to fire off the event. Just need to make the input as dynamic as possible now. The timer solution is a good one but could cause problems if it fires off an event which isn't ready - would need a bit of error handling for this to work smoothly.

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question