Coolite自定义验证,VType


Ext.apply(Ext.form.VTypes, {
         repetition: 
function(val, field) {     //返回true,则验证通过,否则验证失败

             var isValid='';
             Coolite.AjaxMethods.
<%=this.ClientID %>
.GetHospital(val,{
                success:
function
(result){
                    alert(result);
                    isValid
=
result;
                },
                failure:
function
(errorMsg)
                {
                    Ext.Msg.alert(
'失败'
,errorMsg);
                }
             });
             alert(isValid);
             
if (isValid=='true'
)
             {
                
return  true
;
             }
             
else

             {
                
return false;
             }
         },
         repetitionText: 
'当前医院已经存在!'

        })

<ext:Anchor Horizontal="95%">
                
<ext:TextField runat="server" ID="dataFullName" FieldLabel="医院全称"  Vtype="repetition" AllowBlank="false"></ext:TextField>
            
</ext:Anchor>

Code

 

功能就是在输入内容的时候,动态的进入后台,验证次数据是否存在

原文:http://www.cnblogs.com/DNNCenter/archive/2009/08/08/1542018.html

你可能感兴趣的:(type)