-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I've found, quite to my surprise, that it's possible to type e and % into a doublebox. It may make sense in some cases, but I'd like to know whether there is some way to prevent these characters from being typed.
Moreover, in IE it's possible to type € (even if no currency symbol is specified in the doublebox' format) as well as # and @. But for the € symbol (as long as the format allows for it) I can't imagine why should it be possible to type # and @. Is it really meant to be like that? And if so, is there any way to constrain doubleboxes so that they only accept numbers, sign marks and group and decimal separators?
In order to reproduce this just try the following in the online sandbox using IE (it also happens as of zk 6.0.1):
<doublebox format="0.00" width="150px" />
With kind regards
César Varona
César,
You could always override what keys it will accept like this:
<doublebox format="0.00" width="150px" > <attribute w:name="doKeyPress_"> function(evt){ if (!this._shallIgnore(evt, "0123456789,.")) // modify this as needed this.$doKeyPress_(evt); } </attribute> </doublebox>
Regards,
Todd
Hi,
thanx for your reply, but it still does allow for the entering of @, # and € in IE (not in FF). The _shallIgnore method explicitly accepts alt combinations (such as @, # and € in my spanish layout keyboard):
_shallIgnore: function (evt, keys) { var code = (zk.ie||zk.opera) ? evt.keyCode : evt.charCode; if (!evt.altKey && !evt.ctrlKey && _keyIgnorable(code) && keys.indexOf(String.fromCharCode(code)) < 0) { evt.stop(); return true; } }
so the question should read now "why does evt.altKey yield true in FF and not in IE?". I think there's definitely something wrong with this.
With kind regards
César Varona
They Used Same thing and this is not allowing the Special Characters. See here
I'm afraid it does, you just need IE and a keyboard layout that forces you to combine alt-gr with another key in order to type the (un)desired character.
But even if it wouldn't, the typing of non-numerical characters should be prevented per se, without resorting to custom scripts, shouldn't it?
Hi cvarona,
The alt-gr key is a combination of alt key and ctrl key.
You can override doKeyPress_ function to avoid this.
<zk xmlns:w="client"> <doublebox> <attribute name="w:doKeyPress_"> if (evt.altKey && evt.ctrlKey) evt.stop(); else this.$supers('doKeyPress_', arguments); </attribute> </doublebox> </zk>
Asked: 2012-09-24 10:02:52 +0800
Seen: 224 times
Last updated: Nov 13 '12