EasyUI DataGrid 编辑数据 加邮箱验证 Input 邮箱验证

 

DataGrid:
JSP:
<th data-options="field:'email_mail',width:465,editor:'validatebox', editor:{type:'validatebox',options:{required:true,validType:'email'}}">邮箱</th>

JS:
columns:[[
                    {field:'no',title:'编号',width:50,editor:'numberbox'},
                    {field:'name',title:'名称',width:60,editor:'text'},
                    {field:'addr',title:'地址',width:100,editor:'text'},
                    {field:'email',title:'电子邮件',width:100,
                        editor:{
                            type:'validatebox',
                            options:{
                                validType:'email'
                            }
                        }
                    },
                    {field:'birthday',title:'生日',width:80,editor:'datebox'},
                    {field:'action',title:'操作',width:70,align:'center',
                        formatter:function(value,row,index){
                            if (row.editing){
                                var s = '<a href="#" onclick="saverow('+index+')">保存</a> ';
                                var c = '<a href="#" onclick="cancelrow('+index+')">取消</a>';
                                return s+c;
                            } else {
                                var e = '<a href="#" onclick="editrow('+index+')">编辑</a> ';
                                var d = '<a href="#" onclick="deleterow('+index+')">删除</a>';
                                return e+d;
                            }
                        }
                    }
                ]],
				
				
validType:'email' 为邮箱验证
required:true 为必输项


input:
<input class="easyui-validatebox" validtype="email" required="true" missingMessage="不能为空" invalidMessage="邮箱格式不正确" /><br />  

或
 <script>  
        $(function () {  
            //设置text需要验证  
            $('input[type=text]').validatebox();  
        })  
 </script> 
 <input type="text" validtype="email" required="true" missingMessage="不能为空" invalidMessage="邮箱格式不正确" />

 

你可能感兴趣的:(datagrid)