Protect input fields against accidental overwriting

For the project I have already mentioned here and here, a barcode scanner is used for various tasks. If the input cursor is not in a search field, but in an input field, then the value of the field is overwritten by the scanned value or appended to the existing value. Sometimes this is on purpose, for example when creating a new record and assigning a Barcode to it. Most of the times overwriting an existing value by scanning a Barcode would cause data loss on save. To avoid this I have implemented a write protection for <input />-fields. When …