<!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(){
	$("#editForm").validate({
		rules: {
			"data[MusicCategory][category_name]" : {
				"required" : true,
				"remote" : {
					url : "index.php",
					cache : false,
					data : {
						r : "Music.checkcategory",
						category_name : function(){
							return $("#category_name").val();
						},
						id : function(){
							return $("#category_id").val();
						}
					}
				}
			},
			"data[MusicCategory][show_order]" :{
				required: true,
				number: true,
				digits: true,
				range: [1, 999]
			}
		},
		messages: {
			"data[MusicCategory][category_name]" : {
				"required" : "风格不能为空",
				"remote" : "风格不能重复"
			},
			"data[MusicCategory][show_order]" :{
				required: "排序不能为空",
				number: "排序必须为正整数",
				digits: "排序必须为正整数",
				range: $.format("排序必须在{0}到{1}之间")
			}
		},
		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");
		}
	});
})
</script>
</head>
<body>
<form id="editForm" action="index.php?r=Music.editcategory" method="post">
	<input type="hidden" name="returnParams" value="<!--{$returnParams}-->"/>
	<input type="hidden" name="data[MusicCategory][id]" id="category_id" value="<!--{$data.id}-->"/>
	<table class="tbl_edit" width="100%"><tr>
		<td class="td_name">风格<span class="red">*</span></td>
		<td class="td_content"><input type="text" class="text" id="category_name" name="data[MusicCategory][category_name]" value="<!--{$data.category_name}-->" maxlength="32"/><span id="span_category_name"></span></td>
		</tr><tr>
		<td class="td_name">排序<span class="red">*</span></td>
		<td class="td_content"><input type="text" class="text"  id="show_order" name="data[MusicCategory][show_order]" value="<!--{$data.show_order}-->" maxlength="3"/><span id="span_show_order"></span></td>
		</tr><tr>
		<td class="noborder"></td>
		<td class="noborder"><button type="submit" class="butsubmit">提交</button></td>
		</tr>
	</table>
</form>
</body>
</html>