Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which event to use?

Status
Not open for further replies.

Naoise

Programmer
Joined
Dec 23, 2004
Messages
318
Location
IE

I have a USB peripheral device (barcode scanner) which simple adds the barcode to a form input textbox. This textbox is the only control on the page and when the barcode has been entered the page must submit. I have tried using onChange() to call my javascript function AutoSubmit() but onChange() needs focus to be moved off the textbox before it kicks in so no good. I have also tried onkeypress() which works but if the barcode is 123 it will kick off at 1 rather than wait for the full barcode. Any ideas?
 
You could try onkeypress + setTimeout and then call a function to submit your input.

I don't know the answer but my good friend Google does.
 
Code:
<html>
<script>
	function submitR(){
		frm.action = '[URL unfurl="true"]http://www.yahoo.com';[/URL]
		frm.submit();
	}

</script>


<form name="frm" id="frm">
	<input onKeyPress="setTimeout('submitR()',2000)"> test </button>
</form>

I don't know the answer but my good friend Google does.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top