Dojo Select 小部件验证样式
许多 dojo 表单小部件(例如 DateTextBox)会将自己的样式设置为带有“!”的红色(claro 主题)。指示该字段在焦点后无效。我似乎无法让这种类型的样式与“选择”小部件一起使用。我将值设置为必需,但如果用户将其保留为默认状态(空白),则它保持无样式。
我尝试以编程方式对此进行测试:
wigs = dijit.findWidgets(node);
for( i = 0; i < wigs.length; i++ ) {
wigs[i].focus();
}
这会触发对其他几个小部件的验证,并且它们的样式适当,但不是他选择的小部件。有人知道如何明显地表明这些选定的小部件未经过验证吗?
哦,wigs[i].isValid() 对于那些选择的小部件来说肯定是错误的。
Many dojo form widgets, like DateTextBox will style themselves in red (claro theme) with an "!" to indicate that the field isn't valid after focus. I can't seem to get this type of styling to work with the Select widget. I have the value set to required, but if the user leaves it in the default state, blank, then it remains unstyled.
I tried to test this programmatically:
wigs = dijit.findWidgets(node);
for( i = 0; i < wigs.length; i++ ) {
wigs[i].focus();
}
This triggers validation on several other widgets and they are styled appropriately, but not he Select widgets. Anyone know how to make it obvious that those select widgets are not validating?
Oh, and wigs[i].isValid() is definitely false for those select widgets.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这些情况下 FilteringSelect 使用的样式仍然使用 ValidationTextBox 中的错误样式; Select 的情况并非如此,并且看起来好像任何主题中都没有
.dijitSelectError
的样式。我认为 Select 最初可能不支持任何验证,这可能就是原因。因此,您必须添加自己的样式才能使其正常工作。另请注意,Select 的模板中没有带有
dijitValidationIcon
类的节点,这正是导致 '!' 的原因。在其他小部件中。The styles used by FilteringSelect in these circumstances still use the error styles from ValidationTextBox; this isn't the case for Select, and it looks as if there are no styles for
.dijitSelectError
in any of the themes. I'm thinking Select may not have initially supported any validation so that might be why.So you'd have to add your own styles for this to work. Also note that there is no node with the
dijitValidationIcon
class in Select's template, which is what's responsible for the '!' in those other widgets.