<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
	<head>
	<base href="<%=basePath%>" />
		<title>商品档案</title>
		<link rel="stylesheet" href="css/main.css" type="text/css" />
		<script language="javascript" src="script/main.js"></script>
		<script type='text/javascript' src='dwr/interface/merchandiseAction.js'></script>
<script type='text/javascript' src='dwr/engine.js'></script>
<script type='text/javascript' src='dwr/util.js'></script>
<script type="text/javascript">
	var textAmount;
	function init() {
		textAmount = document.getElementById("amount");

	}
	
	function out_amount() {
		var chk = false;

		if ((!isNaN(textAmount.value)) && textAmount.value > 0
				&& textAmount.value < 999) {

			show_message("msg_amount", "1", '输入正确!');
			chk = true;
		} else {
			show_message('msg_amount', '0', '价格必须输入大于零小于999的数字形式');

		}
		return chk;
	}
	function formSubmit() {
		var chk = false;

		var chkRetName = out_chkMaxLength('name', 'msg_name', '名称小于10位且不能为空!',
				'10');
		var chkRetAmount = out_amount();

		if (chkRetName && chkRetAmount) {
			chk = true;
		}
		return chk;
	}

	window.onload = init;
</script>
	</head>
	<body>
	
		<p></p>
		<s:form action="merchandiseAction" method="post" theme="simple" onsubmit="return formSubmit();">
			<s:hidden name="merchandise.id" ></s:hidden>
	        <s:hidden name="merchandise.code"></s:hidden>
		<p><font style="font-size: 10pt;">档案管理->商品档案->新增</font></p>
		
		<p></p>
		<table border="0" cellpadding="1" cellspacing="1" width="95%">
			<tr>
				<td align="right" width="10%" nowrap="true">商品编号</td>
				<td width="20%">
					<s:textfield name="merchandise.code" cssClass="TextInput" disabled="true"></s:textfield>      </td>
				<td align="right" width="10%" nowrap="true">商品名称</td>
			  <td>
			  <s:textfield name="merchandise.name" cssClass="TextInput" id="name" onFocus="show_message('msg_name','2','请输入名称');"
				onBlur="out_chkMaxLength('name', 'msg_name', '名称小于10位且不能为空!', 10)"></s:textfield>
			<DIV style="DISPLAY: show" id="msg_name" class="box_div_right">&nbsp;</DIV>
			  </td>	
		    </tr>
			<tr>
				<td align="right" width="10%" nowrap="true">商品价格（元）</td>
				<td width="20%"><s:textfield name="merchandise.price" cssClass="TextInput" id="amount"
				onFocus="show_message('msg_amount','2','请输入商品价格')"
				onBlur="out_amount()"></s:textfield>
			<DIV style="DISPLAY: show" id="msg_amount" class="box_div_right">&nbsp;</DIV></td>
				<td align="right" width="10%" nowrap="true">&nbsp;</td>
				
		        <td colspan="2">&nbsp;</td>
			</tr>			
		</table>

		<p></p>
		<div style="margin-left: 30px; margin-right: 0px">
			<table border="0" cellpadding="0" cellspacing="0"  width="95%">
				<tr>
		    	<td width="10%">
		    	<s:submit value="保存" method="updateMerchandise" cssClass="BtnAction"></s:submit>
		    	</td>
		    	<td width="10%">
		    		<input type="button" class="BtnAction" value="返回" onClick="history.go(-1);">
		    	</td>
		    	<td width="80%">&nbsp;</td>   	
		  	</tr>
			</table>
		</div>
		</s:form>
	</body>
</html>