ext onblur校验

clbckz1 2010-11-01 04:33:00
初学extjs,遇到个问题
登录页面,vtype为qtip,输入账号,失去焦点时,立即触发后台的action校验此账号是否存在,不存在时将返回的json中的msg属性的值,放到qtip的提示中。
注意:不是alert出msg,这个很容易。请教ext如何实现?
...全文
246 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ds804370377 2012-03-23
  • 打赏
  • 举报
回复
楼主大哥可不可以把你写完后的代码提供以下,小弟在这里多谢了
clbckz1 2010-11-03
  • 打赏
  • 举报
回复
多谢7楼 这样做会有2套tip 一套是ext原有的 另一套是自定义的 是不是这个问题只能这样了 没有更好的解决方法?
hoojo 2010-11-03
  • 打赏
  • 举报
回复
new Ext.ToolTip({
target: 'passwordId',//显示在password的地方
html: 'Click the X to close me',
title: 'My Tip Title',
autoHide: false,
autoShow: true,
closable: true,
draggable:true
});
clbckz1 2010-11-03
  • 打赏
  • 举报
回复
多谢5楼牛人 但还是未实现我需要的功能 我需要的是在qtip中显示校验信息
clbckz1 2010-11-02
  • 打赏
  • 举报
回复
3楼能否说得详细些,怎么创建一个tip??
leehuat 2010-11-02
  • 打赏
  • 举报
回复
Msg.suggest('提示',返回msg信息);



Ext.ux.suggest = function(){
var msgCt;
function createBox(t, s){
return ['<div class="msg">',
'<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>',
'<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><font color=red><h2>', t, '</h2></font>', s, '</div></div></div>',
'<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',
'</div>'].join('');
}
return {
show : function(title, format, pau){
if(!msgCt){
msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);
}

if(!pau) pau = 3;
var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
var m = Ext.DomHelper.append(msgCt, {html: createBox(title, s)}, true);
m.slideIn('t').pause(pau).ghost("t", {remove: true});
},
mask: function(id, title){
var el = Ext.get(id);
return {
show: function(s){
el.mask(s || title, 'x-mask-loading');
},
hide: function(){
el.unmask();
},
destroy: function(){}
};
}
};
}();


/**
* 重写、扩展Ext.MessageBox某些方法
* @author davi
*/
Ext.apply(Ext.MessageBox, {
msgBox: function(ico, title, msg, fn, scope){
this.show({
title : title,
msg : '<br>' + msg,
buttons: this.OK,
fn: fn,
scope : scope,
icon: ico
});
return this;
},
//信息
info : function(msg, fn, scope){
return this.msgBox(this.INFO, '信息', msg, fn, scope);
},
//问题
quest : function(msg, fn, scope){
return this.msgBox(this.QUESTION, '问题', msg, fn, scope);
},
//警告
warn : function(msg, fn, scope){
return this.msgBox(this.WARNING, '警告', msg, fn, scope);
},
//错误
error : function(msg, fn, scope){
return this.msgBox(this.ERROR, '错误', msg, fn, scope);
},
//提示
cfm : function(msg, fn, scope){
var msg = '<br>' + msg;
return this.confirm('提示', msg, fn, scope);
},
mask: function(el, title){
return Ext.ux.suggest.mask(el, title);
},
//右上角提示
suggest: Ext.ux.suggest.show,
//自定义提示
throwOut: function(type,title,msg, format, pau){
if(type=='suggest') this.suggest(title,msg, format, pau)
else if (type=='alert') return this.alert(title,msg,format,pau);
}
});
var Msg = Ext.MessageBox;
hoojo 2010-11-01
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 clbckz1 的回复:]

多谢1L 这个我知道 问题是怎么把返回的东西放到qtip中?
[/Quote]

自己创建一个tip,设置tip的target的是账号的id即可
clbckz1 2010-11-01
  • 打赏
  • 举报
回复
多谢1L 这个我知道 问题是怎么把返回的东西放到qtip中?
zoujp_xyz 2010-11-01
  • 打赏
  • 举报
回复
不需要用vtype
写个onblur事件请求后台就可以了

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧