• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Interesting form input

Guest
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

Goodday all. Let me give you a brief overview of what im trying to do.
I am developing a a stock management system. And for that we need to take stock.
We use barcodes, which is not a problem.

But however i do not want to have to press a button after each barcode i enter. via barcode scanner.
Therefore i have already developed the java function that does what i need it to do. the problem is the actual input

Calling the function using onchange does not work as we need to press a button .
on keypress does not work as the codes are more than one char.

So my question is, is there any way of delaying the java call for all the chataceters to be placed into the input fied.

Any help would be appreciated.

Regards
Donovan
TOPICS
Advanced techniques

Views

313

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

Hard to comment without code sample but perhaps a SetTimeOut call in JavaScript or have a JS routine to continuously check the size of the input field until it reaches the desired/maximum length, then submit.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 20, 2006 May 20, 2006

Copy link to clipboard

Copied

i dont know the maximum length, that is the problem, it differs everytime, i just need an onchange or on key pressed event that works with a time delay so the whole barcode can be scanned.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 21, 2006 May 21, 2006

Copy link to clipboard

Copied

Can you send an <Enter> key stroke in you barcode scanner after it scans the data? If so, and if your form uses a submit, you can tab off the entry field and onto the button where you "press" the space bar or enter key via scanner programming.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 22, 2006 May 22, 2006

Copy link to clipboard

Copied

I agree with comment stating have barcode software sending an ending input character. But if you cannot enable that, write a JavaScript routine that fires when the field receives input. Have the routine continously check the field for, say, length of value in field. When the length stays constant for more than 3 seconds, then the barcode has been fully inputted and submit the form.

Just a thought.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 24, 2006 May 24, 2006

Copy link to clipboard

Copied

LATEST
Here's one way to do it. The JavaScript routine fires when the value in the input text box changes. Routine takes a snapshot of the length of the value in the input box and initializes a setTimeout for three seconds. After three seconds, the setTimeout compares the snapshot with the current length value. If snapshot=current value, user input has ceased and form is submitted. You can raise the setTimeout time value or lower it based on input speed of barcode equipment, etc.

<script language="JavaScript">

var i = ""; //set global variable for setTimeout call

function bar_init(bar_snapshot_len){
if(i){clearTimeout(i);} //clear previous setTimeout if defined
i = setTimeout(function(){bar_check(bar_snapshot_len)}, 3000); //raise or lower time based on input speed
}

function bar_check(bar_prev_value){
if(bar_prev_value==document.myform.x.value.length){
window.document.myform.submit();
}
}
</script>

<form name="myform">
<input type="text" name="x" onpropertychange="bar_init(document.myform.x.value.length)" size="50">
</form>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation