This question has been flagged

I'm having some problems with allowing the user to enter text with an EXTERNAL keyboard in a point of sale 'textinput' popupwidget. Everything works in the background (orders get registered etc.) but it looks to me like the keys are not registering to the correct view. 

The general idea is this: I want to ask the user of the point of the sale for the customer zip code. The process starts when the 'pay' button is clicked in the ActionpadWidget. The view passes to the Paymentscreenwidget. He then enters the zip code using the 'number' popup widget. (BTW: it's not possible here either to work with the numpad part of the external keyboard)

 When the zip code is not yet present in the database the user should be asked for the city name. That needs to be entered into the 'textinput' widget. However typing text is entered to the textfield. It is possible however copy paste text to the field and from there on everything works fine. 

The javascript code I have a the moment:

QUESTION: How do I get the external keyboard entry to the correct field?

screens.ActionpadWidget.include({
/**
* When the button 'pay' is clicked and the postcode of the customer should be tracked -> show popup.
* When a customer is selected, no popup will be shown and the customer data will be used to register zipcode.
* Unless the zip code in the customer field is unknown. Then a popup will be shown
*/
renderElement: function(){
var self = this;
this._super();
var track_postal_codes = self.pos.config.postal_code_tracking;
this.$('.pay').click(function(){
var postal_codes = self.pos.postal_codes_by_id;
if (track_postal_codes == true) {
console.log(self.pos.get_order().attributes.client);
if (self.pos.get_order().attributes.client){
var client = self.pos.get_order().attributes.client;
if (client.zip == "" || client.city == "") {
self.pos.gui.show_popup('number', {
title: _t('Enter Customer Postal Code'),
value: _t('0'),
confirm: function (new_postal_code) {
if (postal_codes.hasOwnProperty(new_postal_code.toString())) {
self.pos.get_order().set_postal_code(new_postal_code);
} else {
this.pos.gui.show_popup('textinput', {
title: _t('Enter City Name'),
value: _t("New City Name"),
confirm: function (new_city_name) {
self.pos.get_order().set_postal_code(new_postal_code);
self.pos.get_order().set_city_name(new_city_name);
self.pos.postal_codes_by_id[new_postal_code] = new_city_name;
}
});
}
}
});
} else {
if (postal_codes.hasOwnProperty(client.zip.toString())) {
self.pos.get_order().set_postal_code(client.zip);
self.pos.get_order().set_city_name(client.city);
} else {
self.pos.get_order().set_postal_code(client.zip);
self.pos.get_order().set_city_name(client.city);
self.pos.postal_codes_by_id[client.zip] = client.city;
}
}
} else {
self.pos.gui.show_popup('number', {
title: _t('Enter Customer Postal Code'),
value: _t('0'),
confirm: function (new_postal_code) {
if (postal_codes.hasOwnProperty(new_postal_code.toString())) {
self.pos.get_order().set_postal_code(new_postal_code);
} else {
this.pos.gui.show_popup('textinput', {
title: _t('Enter City Name'),
value: _t("New City Name"),
confirm: function (new_city_name) {
console.log(new_city_name);
self.pos.get_order().set_postal_code(new_postal_code);
self.pos.get_order().set_city_name(new_city_name);
self.pos.postal_codes_by_id[new_postal_code] = new_city_name;
}
});
}
}
});
}
}
});
}
});


Avatar
Discard