道场新手 – 试一试. 提交表单后,如果从服务器返回错误,我想在dijit.form.ValidationTextBox上显示该消息 var user_email = dijit.byId("login_user_email");user_email.set("invalidMessage", data["result"]["user_email"]
提交表单后,如果从服务器返回错误,我想在dijit.form.ValidationTextBox上显示该消息
var user_email = dijit.byId("login_user_email"); user_email.set("invalidMessage", data["result"]["user_email"]); //need to force show the tooltip but how???
任何帮助非常感谢.
请参阅 jsFiddle的行动.>只显示工具提示:
var textBox = bijit.byId("validationTextBox"); dijit.showTooltip( textBox.get("invalidMessage"), textBox.domNode, textBox.get("tooltipPosition"), !textBox.isLeftToRight() );
>暂时切换textBox验证器,强制验证,恢复原始验证器:
var originalValidator = textBox.validator; textBox.validator = function() {return false;} textBox.validate(); textBox.validator = originalValidator;
或者一次做两件事.