ASPxTextBox 错误文本在失去焦点时未更新
我得到了这个 ASPxTextBox
:
<dxe:ASPxTextBox ID="txtFirstName" runat="server">
<ClientSideEvents LostFocus="function(s, e) {
if (s.GetText() == '')
{
s.SetIsValid(false);
s.errorText = 'Please enter First Name.';
}
}"></ClientSideEvents>
<ValidationSettings ErrorDisplayMode="ImageWithTooltip">
</ValidationSettings>
</dxe:ASPxTextBox>
但是显示的 errorText
不是我在 LostFocus
事件中设置的内容。相反,工具提示中会显示默认的 errorText
,即“无效值”。
有什么想法吗?谢谢
I got this ASPxTextBox
:
<dxe:ASPxTextBox ID="txtFirstName" runat="server">
<ClientSideEvents LostFocus="function(s, e) {
if (s.GetText() == '')
{
s.SetIsValid(false);
s.errorText = 'Please enter First Name.';
}
}"></ClientSideEvents>
<ValidationSettings ErrorDisplayMode="ImageWithTooltip">
</ValidationSettings>
</dxe:ASPxTextBox>
But the errorText
displayed isn't what I have set inside the LostFocus
event. Instead, the default errorText
which is "Invalid value" is displayed in the tool tip.
Any ideas? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了完成此任务,有必要:
启用“必需”验证(将 ValidationSettings.RequiredField.IsRequired 属性设置为“true”;
指定“必需”errorText (ValidationSettings.RequiredField.ErrorText);
通过设置强制编辑器验证将 ValidationSettings.ValidateOnLeave 属性设置为“true”:
In order to accomplish this task, it is necessary to:
enable “required” validation (set the ValidationSettings.RequiredField.IsRequired property to “true”;
specify the “required” errorText (ValidationSettings.RequiredField.ErrorText);
force editor validation by setting the ValidationSettings.ValidateOnLeave property to “true”:
我碰巧解决了这个问题:
在将
ASPxTextBox
的IsValid
属性设置为falseerrorText
的值代码>.(我想嘲笑我的愚蠢!天啊)
感谢那些帮助过的人。 :)
I happen to solve the problem:
Modifying the value of
errorText
should come first before settingIsValid
property of theASPxTextBox
tofalse
.(I want to laugh at my stupidness! OMG)
Thanks for those who helped. :)