<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <%@ include file="/common/taglibs.jsp"%> <%@page contentType="text/html;charset=UTF-8"%> <%@page pageEncoding="UTF-8"%> <html> <head> <title>新建商品</title> <script type="text/javascript" src="https://www.jb51.net/<%=request.getContextPath()%>/static/v0/scripts/commodity/common_functions.js"></script> <script type="text/javascript" src="https://www.jb51.net/<%=request.getContextPath()%>/static/v0/scripts/commodity/check_data.js"></script> <script type="text/javascript" src="https://www.jb51.net/<%=request.getContextPath()%>/static/v0/scripts/commodity/commodity_create.js"></script> <script type="text/javascript" src="https://www.jb51.net/<%=request.getContextPath()%>/static/v0/scripts/jquery/jquery.form.js"></script> <script type="text/javascript" src="https://www.jb51.net/<%=request.getContextPath()%>/static/v0/scripts/haha.js"></script> <script type="text/javascript" src="https://www.jb51.net/<%=request.getContextPath()%>/static/v0/scripts/haha_upload.js"></script> <script type="text/javascript"> j = 1; $(function(){ updateDiscountPercentage(); $("#btn_add2").click(function(){ //var newNode='<div><div>'; //newNode +='<input type="file" /></div>'; //newNode +='<div><input type="button" value="删除"/></div><div>'; //newNode +='<span></span>'; //newNode +='</div></div>'; //$("#newUploadTd").append(newNode); var newNode2='<div><div>'; newNode2+='<textarea dataType="empty|image|*1-500" tipId="detail_span" errormsg="请输入合法的图片链接,并小于500个字符" rows="1" cols="100"></textarea>'; newNode2+='</div><div> '; newNode2+='<input type="button" value="删除"></div></div>'; $("#showResultTd").append(newNode2); j = j + 1; }); $("input[name='needRobert']").click(function(){ var need=$('input:radio[name="needRobert"]:checked').val(); $("tr[name='Show']").toggle(); /* if(need==1){ $("tr[name='Show']").css('display','block'); }else{ $("tr[name='Show']").css('display','none'); } */ }); }); </script> </head> <body> <form:form method="post" action="#"> <input type="hidden" value="" /> <input type="hidden" value="" /> </form:form> <form:form commandName="currentCommodity" method="post" enctype="multipart/form-data"> <div> <c:if test="${not empty errorMessage }"> <c:out value="${errorMessage }" /> </c:if> </div> <input type="hidden" value="${searchFunctionEntry}" /> <div> <legend>新建商品</legend> <div></div> <fieldset> <div> <%-- <div> <input type="button" value='<fmt:message key="button.save"/>'/> </div>--%> <div> <input type="button" value="返回列表" /> </div> </div> </fieldset> <div></div> <table> <tbody> <tr> <td> <div> <div> <label for="commodityTitle">商品标题:</label> </div> </div> </td> <td> <div> <div> <form:textarea path="title" dataType="s1-50" tipId="title_span" errormsg="请输入合法字符的标题,并小于50个字符" rows="1" cols="100" /> </div> <div> <span>*</span> </div> </div> </td> </tr> <tr> <td> <div> <div> <label for="keyword">关键字:</label> </div> </div> </td> <td> <div> <div> <form:textarea dataType="empty|s1-50" tipId="keyword_span" errormsg="请输入合法字符的关键字,并小于50个字符" path="keyword" rows="1" cols="100" /> </div> <div> <span></span> </div> </div> </td> </tr> <tr> <td> <div> <div> <label for="commodityType">商品分类:</label> </div> </div> </td> <td> <div> <div> <form:radiobutton path="commodityType" value="0" /> 虚拟商品 <form:radiobutton path="commodityType" value="1" checked="true" /> 实体商品 </div> <div> <span>*</span> </div> </div> </td> </tr> <tr> <td> <div> <div> <label for="currencyType">货币单位:</label> </div> </div> </td> <td> <div> <div> <!-- <form:radiobutton path="currencyType" value="0"/>福豆 --> <form:radiobutton path="currencyType" value="1" checked="true" /> 福饼 </div> <div> <span>*</span> </div> </div> </td> </tr> <tr> <td> <div> <div> <label for="pictureLink">图片链接:<span></span></label> </div> </div> </td> <td> <div> <div> <input type="file" size="45" /> </div> <div> <input type="button" value="上传图片" /> </div> <div> <span></span> </div> </div> <div> <div> <form:textarea dataType="image|*1-500" tipId="pictureLink_span" errormsg="请输入合法图片链接,并小于500个字符" path="pictureLink" rows="2" cols="100" /> </div> <div> <span>*</span> </div> </div> </td> </tr> <tr> <td> <div> <div> <label for="totalQuantity">总人次:</label> </div> </div> </td> <td> <div> <div> <form:input dataType="integer" tipId="totalQuantity_span" errormsg="总人次必须为正整数" path="totalQuantity" type="text" maxlength="6" size="6" /> </div> <div> <span>*</span> </div> </div> </td> </tr> <tr> <td> <div> <div> <label for="unitPrice">最低购买注数:</label> </div> </div> </td> <td> <div> <div> <form:radiobutton path="unitPrice" value="1" checked="true" /> 一元 <form:radiobutton path="unitPrice" value="10" /> 十元 </div> <div> <span>*</span> </div> </div> </td> </tr> <!-- 细节图 --> <tr> <td rowspan="2">细节图: <!-- <div> <div> <label for="detailImgs">细节图: <input type="button" value="全部上传" /><span></span></label> </div> </div> --> </td> <td> <div> <div> <input type="file" onchange="fileUpload_onselect(this)" /> <input type="button" value="选择图片" /> </div> <div> <input type="button" value="增加一行" /> </div> <div> <span></span> </div> </div> </td> </tr> <tr> <td><c:forEach var="tmpEntity" items="${currentBanner.detailImages}" varStatus="status"> <div> <div> <textarea rows="1" cols="100">${tmpEntity.url}</textarea> <div> <input type="button" value="删除"> </div> </div> </div> </c:forEach> <div> <div> <textarea dataType="empty|image|*1-500" tipId="detail_span" errormsg="请输入合法的图片链接,并小于500个字符" rows="1" cols="100"></textarea> </div> </div></td> </tr> <tr> <td> </td> <td><span></span></td> </tr> <tr> <td> <div> <div> <label for="tags">标签:</label> </div> </div> </td> <td> <div> <c:forEach var="tmpEntity" items="${allTagList}"> <div> <label><input type="checkbox" value="${tmpEntity.tagId}">${tmpEntity.tagName}</label> <input type="hidden" value="${tmpEntity.tagName}" /> </div> </c:forEach> <div> <span>*</span> </div> </div> </td> </tr> <tr> <td> <div> <div> <label for="tags">是否需要机器人:</label> </div> </div> </td> <td> <div> <div> <form:radiobutton path="needRobert" value="1" /> 是 <form:radiobutton path="needRobert" value="0" checked="true" /> 否 </div> <div> <span>*</span> </div> </div> </td> </tr> <tr> <td> <div> <div> <label for="tags">计划售完时间:</label> </div> </div> </td> <td> <div> <form:input type="number" path="planSoldTime" dataType="integer" tipId="planSoldTime_" errormsg="必须为正整数" min="0" max="9999" /> <div> <span>*</span> </div> </div> </td> </tr> <tr> <td> <div> <div> <label for="tags">最大购买次数:</label> </div> </div> </td> <td> <div> <form:input type="number" dataType="integer" tipId="regularTriggerTotalTimes_" errormsg="必须为正整数" path="regularTriggerTotalTimes" min="1" max="10" /> <div> <span>*</span> </div> </div> </td> </tr> </div> </tbody> </table> </div> </form:form> <div></div> <div> <div> <input type="button" value='提交并预览' /> </div> </div> </body> </html>
这个是html的用法不用考虑其他的就是html代码
function validateForm1(){ var flag=HaHaUtil.checkFrom('detailDataForm'); return flag; }
这个是from表单之前的数据校验的函数。