<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title><!--{$UUDEV_PAGE_TITLE}--></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script>
$().ready(function(){
	jQuery.validator.addMethod("ip", function(value, element) {
		  return this.optional(element) || (/^(\d+)\.(\d+)\.(\d+)\.([\d|\*]+)$/.test(value) && (RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && (RegExp.$4<256 || RegExp.$4=="*")));   
		}, "请输入合法的IP信息");
	
	$("#updateForm").validate({
		rules: {
			"data[IllegalMobileIp][ip]" : {
				"required":true,
				"ip":true,
				remote : {
					url : "index.php",
					cache : false,
					data : {
						r : "SiteSet.check_illegal_mobile_ip",
						illegal_ip_id: function(){
							return $("#id").val();
						},
						illegal_ip: function(){
							return $("#ip").val();
						}
					}
				}				
			}
		},
		messages: {
			"data[IllegalMobileIp][ip]" : {
				"required":"请输入IP",
				"remote":"IP已存在"
			}
		},
		errorPlacement: function(error, element){
			$("#span_" + element.attr("id")).html(error).attr("class", "error");
		},
		submitHandler: function(form){
			setDisabled(":button",window.document);
			form.submit();
		},
		errorClass: "invalid",
		success: function(label){
			label.parent().html("&nbsp;").attr("class", "valid");
		},
		onkeyup: false
	});
});
</script>
</head>
<body>
	<form id="updateForm" action="index.php?r=SiteSet.updateillegalmobileip" method="post">
		<input type="hidden" id="id" name="data[IllegalMobileIp][id]" value="<!--{$data.id}-->"/>
		<input type="hidden" name="returnParams" value="<!--{$returnParams}-->"/>
		<table class="tbl_edit" width="100%"><tr>
			<td class="td_name">IP<span class="red">*</span></td>
			<td class="td_content"><input type="text" class="text" id="ip" name="data[IllegalMobileIp][ip]" value="<!--{$data.ip}-->"/><img class="tiptip" title="IP地址支持“*”号，表示1到256之间的任何一个数字" src="images/quest.gif"/><span id="span_ip"></span></td>
		</tr><tr>
			<td class="td_name">备注</td>
			<td class="td_content"><input type="text" class="text" name="data[IllegalMobileIp][memo]" value="<!--{$data.memo}-->"/></td>
		</tr><tr>
		<td class="noborder"></td>
		<td class="noborder"><button type="submit" class="butsubmit">提交</button></td>
		</tr></table>
	</form>
</body>
</html>