From: john Date: Mon, 29 Oct 2018 08:22:19 +0000 (+0800) Subject: Roo/bootstrap/PhoneInput.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=679a5d3e5f7b8fb1a650d6784abf5e0751e12be7 Roo/bootstrap/PhoneInput.js roojs-bootstrap.js roojs-bootstrap-debug.js --- diff --git a/Roo/bootstrap/PhoneInput.js b/Roo/bootstrap/PhoneInput.js index 36171e800a..ae99b8850d 100644 --- a/Roo/bootstrap/PhoneInput.js +++ b/Roo/bootstrap/PhoneInput.js @@ -295,6 +295,7 @@ Roo.extend(Roo.bootstrap.PhoneInput, Roo.bootstrap.TriggerField, { this.list.on('mouseover', this.onViewOver, this); this.list.on('mousemove', this.onViewMove, this); + // this.inputEl().on("keyup", this.onKeyUp, this); this.inputEl().on("keypress", this.onKeyPress, this); this.tpl = '
  • {name} +{dialCode}
  • '; @@ -545,13 +546,28 @@ Roo.extend(Roo.bootstrap.PhoneInput, Roo.bootstrap.TriggerField, { return this.el.select('input.hidden-tel-input',true).first(); }, + onKeyUp : function(e){ + + if(this.allowed.indexOf(String.fromCharCode(e.getCharCode())) === -1){ + e.stopEvent(); + } + + Roo.log(this.getValue()); + + this.setValue(this.getValue()); + }, + onKeyPress : function(e){ if(this.allowed.indexOf(String.fromCharCode(e.getCharCode())) === -1){ e.stopEvent(); } + Roo.log(this.getValue()); + this.setValue(this.getValue()); } + + }); \ No newline at end of file diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 55c528de22..133b6dd55b 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -40138,6 +40138,7 @@ Roo.extend(Roo.bootstrap.PhoneInput, Roo.bootstrap.TriggerField, { this.list.on('mouseover', this.onViewOver, this); this.list.on('mousemove', this.onViewMove, this); + // this.inputEl().on("keyup", this.onKeyUp, this); this.inputEl().on("keypress", this.onKeyPress, this); this.tpl = '
  • {name} +{dialCode}
  • '; @@ -40388,15 +40389,30 @@ Roo.extend(Roo.bootstrap.PhoneInput, Roo.bootstrap.TriggerField, { return this.el.select('input.hidden-tel-input',true).first(); }, + onKeyUp : function(e){ + + if(this.allowed.indexOf(String.fromCharCode(e.getCharCode())) === -1){ + e.stopEvent(); + } + + Roo.log(this.getValue()); + + this.setValue(this.getValue()); + }, + onKeyPress : function(e){ if(this.allowed.indexOf(String.fromCharCode(e.getCharCode())) === -1){ e.stopEvent(); } + Roo.log(this.getValue()); + this.setValue(this.getValue()); } + + }); /** * @class Roo.bootstrap.MoneyField diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index a2bb430342..0ed5389b87 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1658,7 +1658,8 @@ if(!d){return false;}return d;},setDialCode:function(v){this.dialCodeHolder.dom. }return v;},setValue:function(v){var d=this.getDialCode(v);if(v.length==0||!d||d.length==0){if(this.rendered){this.inputEl().dom.value=(v===null||v===undefined?'':v);this.hiddenEl().dom.value=(v===null||v===undefined?'':v);}return;}this.setFlagClass(this.dialCodeMapping[d].iso2); this.setDialCode(d);this.inputEl().dom.value=v.replace('+'+d,'');this.hiddenEl().dom.value=this.getValue();this.validate();},getDialCode:function(v){v=v||'';if(v.length==0){return this.dialCodeHolder.dom.value;}var A="";if(v.charAt(0)!="+"){return false;} var B="";for(var i=1;i