本文主要是介绍添加时弹出对话框表单,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.在添加时候弹出对话框式的表单:
显示页面:
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/WEB-INF/struts-app.tld" prefix="app" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<jsp:useBean id="st_serachdatabean" scope="session" class="com.execrm.webcommon.table.TableBean"/>
<html>
<head>
<title></title>
<link rel="stylesheet" href="<html:rootpath/>/include/crmstyle.css">
</head>
<body style="margin:0px;overflow:hidden;" width="100%" height="100%">
<script lanuage="javascript">
</script>
<html:form action="/bm/stockaction">
<html:hidden property="code"/>
<html:hidden property="supplier"/>
<html:hidden property="supplierid"/>
<html:hidden property="status"/>
<html:hidden property="startdate"/>
<html:hidden property="enddate"/>
<html:hidden property="optype"/>
<html:hidden property="stockid"/>
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr>
<td width="100%" height="100%" valign="top">
<%
//设置隐藏第1列
st_serachdatabean.setUnVisiable(0);
st_serachdatabean.setCaption("列表");
String str = new String();
str = "<nobr>";
str += "<input type=\"button\" name=\"goods\" value=\"到货\" class=\"listbutton2\" οnclick=\"onGoods(this.form);\">";
str += "<input type=\"button\" name=\"takeeffect\" value=\"生效\" class=\"listbutton2\" οnclick=\"TakeEffect(this.form);\">";
str += "<input type=\"button\" name=\"mod\" value=\"修改\" class=\"listbutton2\" οnclick=\"onMod(this.form);\">";
str += "<input type=\"button\" name=\"add\" value=\"新增\" class=\"listbutton2\" οnclick=\"onAdd(this.form);\">";
str += "<input type=\"button\" name=\"del\" value=\"删除\" class=\"listbutton2\" οnclick=\"onDel(this.form);\">";
str += "</nobr>";
st_serachdatabean.setOperationStr(str);
//设置列点击事件
st_serachdatabean.setHref(1,0,"onMod");
st_serachdatabean.printTable(out);
%>
</td></tr>
</table>
</html:form>
</body>
<script lanuage="javascript">
if(document.forms[0].optype.value == "cantdel"){
alert("该采购单存在明细项,请先删除其明细项!");
document.forms[0].optype.value ='';
}
//增加
function onAdd(form)
{
var returndata = window.showModalDialog("<html:rootpath/>/bm/001/StockInfoFrame.jsp?optype=0","新增信息","dialogHeight:450px;dialogWidth:700px; edge: Raised; center: Yes; help: No; resizable: yes; status: No ;");
if (returndata != null){
//refresh list
document.forms[0].optype.value = '';
document.forms[0].submit();
}
}
</script>
</html>
添加信息页:
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/WEB-INF/struts-app.tld" prefix="app" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<head>
<title></title>
<link rel="stylesheet" href="<html:rootpath/>/include/crmstyle.css">
<script type="text/javascript" src="<html:rootpath/>/include/crmmain.js"></script>
<script type="text/javascript" src="<html:rootpath/>/staticJavascript.jsp"></script>
</head>
<body style="margin:0px;overflow:auto;" width="100%" height="100%">
<html:form action="/bm/stockaction" focus="code ">
<html:hidden property="optype"/>
<html:hidden property="stockid"/>
<html:hidden property="supplierid"/>
<html:hidden property="employeenameid"/>
<%--<html:hidden property="transcompanyid"/>
--%>
<table class="lineTable" id="Table2" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td background="<html:rootpath/>/image/xj.gif" class=dthtxt><img src="<html:rootpath/>/image/TA.gif" width="18" height="11">详细信息</td>
</tr>
<tr><td class="tdtable" width="100%" height="100%">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="4px"><nobr>采购单号<font color="#FF0000">*</font></nobr></td>
<td width="30%"><html:text property="code" styleClass="stext" style="width:100%;" /></td>
<td width="4px"> </td>
<td width="4px"><nobr>采购员</nobr></td>
<td width="30%"><html:crmsel property="employeename" strname="'sm_employee', 'employeename~employeenameid~'" styleClass="stext" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>采购日期</nobr></td>
<td width="30%"><html:date property="stockdate" readonly="true" styleClass="rstext" maxlength="50" style="width:100%;" /></td>
<td width="4px"> </td>
</tr>
<tr>
<td width="4px"><nobr>供应商<font color="#FF0000">*</font></nobr></td>
<td width="30%"><html:crmsel property="supplier" strname="'pm_supplier', 'supplier~supplierid~linkman~linktel~'" styleClass="stext" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>联系人</nobr></td>
<td width="30%"><html:text property="linkman" styleClass="stext" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>联系电话</nobr></td>
<td width="30%"><html:text property="linktel" styleClass="stext" style="width:100%;"/></td>
<td width="4px"> </td>
</tr>
<tr>
<td width="4px"><nobr>发货方式<font color="#FF0000">*</font></nobr></td>
<td width="30%"><html:resourceselect property="transmethod" resourceid="VM001" styleClass="sselect" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>发货起始地</nobr></td>
<td width="30%"><html:text property="transsource" styleClass="stext" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>发货目的地</nobr></td>
<td width="30%"><html:text property="transdestination" styleClass="stext" style="width:100%;"/></td>
<td width="4px"> </td>
</tr>
<tr>
<td width="4px"><nobr>货运公司</nobr></td>
<td width="30%"><html:text property="transcompany" styleClass="stext" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>联系方式</nobr></td>
<td width="30%"><html:text property="translinkway" styleClass="stext" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>税率</nobr></td>
<td width="30%"><html:text property="taxrate" styleClass="stext" style="width:100%;" οnkeypress="editKeyBoard(this,'0123456789.','请输入数字型数据');"/></td>
<td width="4px"> </td>
</tr>
<tr>
<td width="4px"><nobr>付款方式</nobr></td>
<td width="30%"><html:resourceselect property="paymethod" resourceid="VM005" isnull="1" styleClass="sselect" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>应付金额</nobr></td>
<td width="30%"><html:text property="apamount" readonly="true" styleClass="rstext" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>实付金额</nobr></td>
<td width="30%"><html:text property="fpamount" readonly="true" styleClass="rstext" style="width:100%;" /></td>
<td width="4px"> </td>
</tr>
<tr>
<td width="4px"><nobr>付款状态</nobr></td>
<td width="30%"><html:text property="paystatus" readonly="true" styleClass="rstext" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>到货状态</nobr></td>
<td width="30%"><html:text property="transstatus" readonly="true" styleClass="rstext" style="width:100%;"/></td>
<td width="4px"> </td>
<td width="4px"><nobr>采购单状态</nobr></td>
<td width="30%"><html:text property="status" readonly="true" styleClass="rstext" style="width:100%;"/></td>
<td width="4px"> </td>
</tr>
<tr>
<td width="4px" valign="top"><nobr>备注</nobr></td>
<td width="*" colspan="7"><html:textarea property="memo" styleClass="stextarea" style="width:100%;height=55px;"
></html:textarea></td>
<td width="4px"> </td>
</tr>
<tr>
<td width="*" colspan="8" align="center">
<input type="button" name="ok" value="保存" class="formbutton2" οnclick="onSave(this.form)">
</td>
<td width="4px"> </td>
</tr>
</table>
</td></tr>
<tr><td><iframe name="sublist" style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 100%; Z-INDEX: 2" scrolling=auto frameborder=0
></iframe></td>
</tr>
</table>
</html:form>
<script type="text/javascript" language="Javascript1.1">
sublist.location.href="<html:rootpath/>/bm/stockaction.do?optype=6&stockid=<%= request.getParameter("stockid")%>&status="+document.forms[0].status.value;
if (document.forms[0].optype.value == '1' || document.forms[0].optype.value == '4'){
parent.parent.window.returnValue = "refresh";
}
function checkData(form) {
//判断数据是否为空
if (form.code.value == ''){
alert('采购号不能为空!');
return false;
}
if (form.supplier.value == ''){
alert('供应商不能为空!');
return false;
}
if (form.transmethod.value == ''){
alert('发货方式不能为空!');
return false;
}
return true;
}
function onClose(){
window.close();
}
function onSave(form ){
if(checkData(form)){
if(form.optype.value == "0")
form.optype.value = "1";
else if(form.optype.value=="3")
form.optype.value = "4";
form.submit();
}
}
</script>
</body>
</html:html>
这篇关于添加时弹出对话框表单的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!