将 zk 文本框更改为 zk int/decimal 框
我在 java 文件中使用 zk 文本框。当满足特定条件时,我想设置一个约束,使文本框仅接受“数字或小数”。有没有办法设置约束等等?
我正在寻找的是这样的:
private Textbox tb = new Textbox(); 如果(条件){ tb.setConstraint("仅限数字"); }
谢谢, 索尼
I am using a zk textbox in a java file. When a particular condition meets, I would like to set a constraint such that the textbox accepts only "numbers or decimals". Is there a way to set a constraint or so ?
What I am looking for is something like this:
private Textbox tb = new Textbox();
if (condition) {
tb.setConstraint("numbers only");
}
Thanks,
Sony
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Zk提供了intbox和decimalbox...你可以使用这些组件代替那些文本框
Zk provides intbox and decimalbox... u can use these components instead of those textbox
据我所知,没有这样的限制。但是,您可以实现自己的。 ZK javadoc中有一些关于约束的信息
只是好奇,为什么不使用intbox或decimalbox ?
As far as I know, there is no such constraint. However, you could implement your own. There is some info about constraint in ZK javadoc
Just curious, why not use intbox or decimalbox?
您可以使用 intBox 找到 Zk,它会很适合您...
有关更多详细信息,您可以找到 这里
You can find Zk with intBox which will work fine for you...
For more details you can found here
ZK intbox 的问题是它会跳过前导零,例如,如果 v 有一种情况,我们只想输入数字,我们也必须保留前导零,例如 00230 ,在这种情况下,intbox 将丢弃前导零并返回230.
problem with ZK intbox is that it will skip the leading zeros , for example if v have a situation where we want to enter only number also also we have to keep leading zero for e.g 00230 , in this case intbox will discard leading zero and will return 230.