ExtJS4:如何在文本框、组合框等旁边显示验证错误消息 [英] ExtJS4: How to show validation error message next to textbox, combobox etc
问题描述
我需要实现显示在无效字段旁边的验证消息.任何帮助将不胜感激.
I need to implement validation messages that appear right next to invalid field. Any help would be appreciated.
推荐答案
msgTarget: 'side'
将在字段右侧添加一个错误图标,仅在悬停时在弹出窗口中显示消息.
msgTarget: 'side'
will Add an error icon to the right of the field, displaying the message in a popup on hover only.
如果你仔细阅读文档,msgTarget 还有一个选项 http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Text-cfg-msgTarget
if you read the documentation carefully, one more option is there for msgTarget http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Text-cfg-msgTarget
[element id] 将错误信息直接添加到指定元素的innerHTML中.您必须使用 id 在控件的右侧动态添加一个td".那么如果您指定 msgTarget: 'element id'
它将起作用.
[element id] Add the error message directly to the innerHTML of the specified element.
you have to add a "td" to the right side of the control dynamically with the id. then if you specify msgTarget: 'element id'
it will work.
这篇关于ExtJS4:如何在文本框、组合框等旁边显示验证错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!