Utilizing "onkeypress" with input field

(BKessel) #1

I’m trying to receive input from a scanner (which acts as a keyboard input). But I’m having trouble with two issues:
1. Calling a hype function from “onkeypress”:
Using the html-widget, I’ve inserted an input field with the an onkeypress call as if externally to the API follows:

<input type="text" size="40" onkeypress="HYPE.documents['main'].functions().alertme(hypeDocument, element, event)" id="my text">

I’ve also tried the “usual” way to call a function from within Hype:

<input type="text" size="40" onkeypress="HYPE.document.functions().alertme(hypeDocument, element, event)" id="my text">

2. Setting focus to the input field


This does not work however.