81,092
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title>XX</title>
<script type='text/javascript' src='<%=path%>/script/mytree.js'></script>
<script type='text/javascript'>
jQuery(function($) {
$.getJSON('<%=path%>/contacts!queryAllContactsGroup.action').done(function(d){
var obj=document.getElementById('contactsGroupId');
var names=document.getElementById('names').value;
for(var i=0;i<d.total;i++){
obj.options.add(new Option(d.rows[i].name,d.rows[i].cgroup_id));
if(d.rows[i].name==names){
obj.options[i].selected=true;
}
}
});
$('#btnSave').click(function() {
$('#contactForm').form('submit');
if ($('.validatebox-invalid').length > 0) {
return;
}
var cgroupId=document.getElementById('contactsGroupId').value;
$.postJSON('<%=path%>/contacts!newContacts.action?cgroupId='
+ cgroupId,
$.formJson('contactForm')).done(
function(arguements) {
window.close();
window.opener.$("#btnOnlyQuery")
.click();
}).fail(function() {
$.messager.alert('提示', ' 保存失败!');
});
});
$('#btnClose').click(function() {
window.close();
});
$
.extend(
$.fn.validatebox.defaults.rules,
{
phone : {
// 验证电话号码
validator : function(value) {
return /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/i
.test(value);
},
message : '格式不正确,请使用下面格式:020-88888888'
},
length : {
validator : function(value, param) {
var len = $.trim(value).length;
return len <= param[1];
},
message : "输入内容长度必须介于{0}和{1}之间."
},
mobile : {
// 验证手机号码
validator : function(value) {
return /^(13|15|18)\d{9}$/i.test(value);
},
message : '手机号码格式不正确'
},
zip : {
// 验证邮政编码
validator : function(value) {
return /^[1-9]\d{5}$/i.test(value);
},
message : '邮政编码格式不正确'
},
qq : {// 验证QQ,从10000开始
validator : function(value) {
return /^[1-9]\d{4,9}$/i.test(value);
},
message : 'QQ号码格式不正确'
}
});
$('#qq').validatebox({
validType : 'qq'
});
$('#email').validatebox({
validType : 'email'
});
$('#officeZipcode').validatebox({
validType : 'zip'
});
$('#homeZipcode').validatebox({
validType : 'zip'
});
});
</script>
</head>
<body>
<div id="divEdit" class="div_edit">
<form id='contactForm'>
<table class="div_edit_table">
<tr>
<th>通讯录分组</th>
<td><select id='contactsGroupId' name="theUnit"
style='width:500px; float:left; '>
</select>
</td>
</tr>
<tr>
<th>姓名</th>
<td><input id='name' class="easyui-validatebox" type="text"
required="true" validType="length[1,8]" name="contacts.name"
value=""></input> <input id='names' type="text" hidden="true"
style="display:none" value='${name}'></input>
</td>
</tr>
<tr>
<th>称呼</th>
<td><input id='appellation' class="easyui-validatebox"
type="text" validType="length[1,40]"
name="contacts.appellation" value=""></input>
</td>
</tr>
<tr>
<th>单位</th>
<td><input id='theUnit' class="easyui-validatebox" type="text"
validType="length[1,200]" name="contacts.theUnit"
value=""></input>
</td>
</tr>
<tr>
<th>职务</th>
<td><input id='position' class="easyui-validatebox"
type="text" validType="length[1,100]"
name="contacts.position" value=""></input>
</td>
</tr>
<tr>
<th>手机</th>
<td><input id='mobile' class="easyui-validatebox" type="text" validType="mobile"
name="contacts.mobile" value=""></input>
</td>
</tr>
<tr>
<th>其他手机</th>
<td><input id='otherMobile' class="easyui-validatebox" validType="mobile"
type="text" name="contacts.otherMobile" value=""></input>
</td>
</tr>
<tr>
<th>办公电话</th>
<td><input id='officePhone' class="easyui-validatebox" validType="phone"
type="text" name="contacts.officePhone" value=""></input>
</td>
</tr>
<tr>
<th>住宅电话</th>
<td><input id='homePhone' class="easyui-validatebox" validType="phone"
type="text" name="contacts.homePhone" value=""></input>
</td>
</tr>
<tr>
<th>其他电话</th>
<td><input id='otherPhone' class="easyui-validatebox" validType="phone"
type="text" name="contacts.otherPhone" value=""></input>
</td>
</tr>
<tr>
<th>QQ</th>
<td><input id='qq' class="easyui-validatebox" type="text" validType="qq"
name="contacts.qq" value=""></input>
</td>
</tr>
<tr>
<th>电子邮箱</th>
<td><input id='email' class="easyui-validatebox" type="text" validType="email"
name="contacts.email" value=""></input>
</td>
</tr>
<tr>
<th>办公地址</th>
<td><input id='officeAddr' class="easyui-validatebox"
type="text" validType="length[1,200]" name="contacts.officeAddr"
value=""></input>
</td>
</tr>
<tr>
<th>办公邮编</th>
<td><input id='officeZipcode' class="easyui-validatebox" validType="zip"
type="text" name="contacts.officeZipcode" value=""></input>
</td>
</tr>
<tr>
<th>住宅地址</th>
<td><input id='homeAddr' class="easyui-validatebox"
type="text" validType="length[1,200]" name="contacts.homeAddr"
value=""></input>
</td>
</tr>
<tr>
<th>住宅邮编</th>
<td><input id='homeZipcode' class="easyui-validatebox" validType="zip"
type="text" name="contacts.homeZipcode" value=""></input> <input
id='cgroupId' class="easyui-validatebox" name="contacts.cgroupId"
style="display:none;" value='${contactsGroup.cgroupId}'></input></td>
</tr>
<tr>
<th>备注</th>
<td><textarea id='remark' rows="3" name="contacts.remark"></textarea>
</td>
</tr>
</table>
<div class="div_edit_opt">
<a id="btnSave" class="easyui-linkbutton"
data-options="iconCls:'icon-save'">保存</a> <a id="btnClose" style="margin-left:10px"
class="easyui-linkbutton" data-options="iconCls:'icon-cancel'">关闭</a>
</div>
</form>
</div>
</body>
</html>