SB1-how to autohide keyboard after scanner detected a value

I have an input field with scanner-enabled attribute as true, when the user focus is on this input field the scanner works and able to scan the barcode. But i have a requirement where i need to format the scanner barcodes to pad with some digits and then auto close the keyboard and display the formatted value in the input field (this behavior is similar to the data-autoReturn attribute which auto hides the keyboard when the maxlength is reached), how can i do this?