I am trying to get my mobile web application scan a QR code. On scanning the entire JSON is getting populated into one single field. It's not getting parsed and populated properly.
On seeing the developer tools, I'm getting
12Failed to decode downloaded font:
12OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
Edit: I think both the errors have nothing to do with QR code scanning. These are errors are coming when ever the text field is touched. Bascially how is Honeywell device dealing the QR code. Does it call some default JavaScript functions?
The JavaScript and HTML is like,
onScan: function QRScan(scannedData) {
if (!scannedData || !scannedData.data) {
return;
}
if (scannedData && (scannedData.type === 'AZTEC' || scannedData.type === 'QR')) {
var data;
try {
data = JSON.parse(scannedData.data.trim() || '{}');
} catch (e) {
alert(e.message);
}
this.$('input#fname').val(data.a);
this.$('input#lname').val(data.b);
this.$('input#city').val(data.c);
this.$('input#phone').val(data.d);
this.$('input#email').val(data.e);
}
}
<!DOCTYPE html>
<html>
<body>
<h1>Sample HTML</h1>
<form onsubmit="myFunction()">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<label for="lname">City:</label>
<input type="text" id="city" name="city"><br><br>
<label for="lname">Phone:</label>
<input type="text" id="phone" name="phone"><br><br>
<label for="lname">Email:</label>
<input type="text" id="email" name="email"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>