GWT 日期框水印/占位符
我想在 GWT DateBox 内设置水印/占位符。我知道如何使用 onFocus 和 onBlur 在普通文本框中设置水印/占位符。我认为在 DateBox 中这样做会相对相似。目前设置文本看起来像这样,但什么也不做。
Datebox box = new DateBox();
box.getTextBox().setText("mm/dd/yyyy");
有什么原因导致这行不通吗?
I want to set a watermark/placeholder inside of a GWT DateBox. I know how to use onFocus and onBlur to set up a watermark/placeholder in a normal TextBox. I assumed that doing so in a DateBox would be relatively similar. Setting up the text currently looks like this, but does nothing at all.
Datebox box = new DateBox();
box.getTextBox().setText("mm/dd/yyyy");
Is there a reason that this would not be working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想您实际上在这里谈论的是能够设置占位符文本。我之前在此处发布了
TextBox
元素的解决方案。该过程非常相似:然后将
DateBox
对象替换为DateField
对象,然后只需调用someDateField.setPlaceholder("mm/dd/yyyy" );
。I imagine what you were actually talking about here was being able to set placeholder text. I posted a solution for
TextBox
elements here before. The process would be quite similar:Then replace your
DateBox
objects withDateField
objects, and you'd just callsomeDateField.setPlaceholder("mm/dd/yyyy");
.