You should definitely try with onchange. But without using oninput because 
otherwise the field is updated from the model. If you update the model 
after the field changes there shouldn't be any difference from using a 
plain html input.

On Friday, 28 April 2017 13:47:35 UTC-3, Chris Van Vranken wrote:
>
> I'm using the oninput event, the onchange event occurs when the element 
> loses focus.  The contents of the textbox are wrong before the onchange 
> event even fires, so I don't believe the onchange event will be helpful for 
> solving this.  I think maybe I need to prevent elm from modifying the value 
> of the textbox and then read in the final value when the scanner sends the 
> enter key, which it does every time it finishes scanning the barcode.
>
> On Friday, April 28, 2017 at 11:06:03 AM UTC-4, Simon wrote:
>>
>> not sure whether this is relevant but can you take advantage of the 
>> difference between the `oninput` and `onchange` events in a text field?
>>
>>
>> On Friday, 28 April 2017 07:51:48 UTC-7, Chris Van Vranken wrote:
>>>
>>> I'm using a barcode scanner to enter data into an elm textfield.  The 
>>> barcode scanner basically works like a keyboard with a user that makes very 
>>> rapid keystrokes.  This rapid entry causes random characters to be missing 
>>> in the textfield.  If the scan is supposed to enter "50494'', one or more 
>>> of these characters will often be missing.  Using the debugger I see that 
>>> my model has values for that field that change from "5" to "50" to "504" to 
>>> "509" to "5094", but it should be "5" to "50" to "504" to "5049" to 
>>> "50494"  So it ends up replacing "504" with "509" instead of with "5049". 
>>>  I believe this is a threading issue where two events are firing in 
>>> parallel instead of in sequence, and both events are starting with the same 
>>> model data ("50") with the output of one event replacing the output of the 
>>> other, when instead the output model for one event should be the input for 
>>> the next event.  Is this a bug in Elm?  How do I fix this?
>>>
>>> Thanks,
>>> Chris
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to