添加时弹出对话框表单

2024-01-27 21:48
文章标签 表单 对话框 时弹

本文主要是介绍添加时弹出对话框表单,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</td>
                                <td width="4px"><nobr>联系人</nobr></td>
                                <td width="30%"><html:text property="linkman"  styleClass="stext" style="width:100%;"/></td>                                               
                                <td width="4px">&nbsp;</td>
                                <td width="4px"><nobr>联系电话</nobr></td>
                                <td width="30%"><html:text property="linktel"  styleClass="stext" style="width:100%;"/></td>                                                       
                                <td width="4px">&nbsp;</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">&nbsp;</td>
                                <td width="4px"><nobr>发货起始地</nobr></td>
                                <td width="30%"><html:text property="transsource"  styleClass="stext" style="width:100%;"/></td>                                               
                                <td width="4px">&nbsp;</td>
                                <td width="4px"><nobr>发货目的地</nobr></td>
                                <td width="30%"><html:text property="transdestination"  styleClass="stext" style="width:100%;"/></td>                                                       
                                <td width="4px">&nbsp;</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">&nbsp;</td>
                                <td width="4px"><nobr>联系方式</nobr></td>
                                <td width="30%"><html:text property="translinkway"  styleClass="stext" style="width:100%;"/></td>                                               
                                <td width="4px">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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>

这篇关于添加时弹出对话框表单的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


原文地址:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.chinasem.cn/article/651573

相关文章

Python实现自动化表单填写功能

《Python实现自动化表单填写功能》在Python中,自动化表单填写可以通过多种库和工具实现,本文将详细介绍常用的自动化表单处理工具,并对它们进行横向比较,可根据需求选择合适的工具,感兴趣的小伙伴跟... 目录1. Selenium简介适用场景示例代码优点缺点2. Playwright简介适用场景示例代码

最新Spring Security实战教程之表单登录定制到处理逻辑的深度改造(最新推荐)

《最新SpringSecurity实战教程之表单登录定制到处理逻辑的深度改造(最新推荐)》本章节介绍了如何通过SpringSecurity实现从配置自定义登录页面、表单登录处理逻辑的配置,并简单模拟... 目录前言改造准备开始登录页改造自定义用户名密码登陆成功失败跳转问题自定义登出前后端分离适配方案结语前言

Gin框架中的GET和POST表单处理的实现

《Gin框架中的GET和POST表单处理的实现》Gin框架提供了简单而强大的机制来处理GET和POST表单提交的数据,通过c.Query、c.PostForm、c.Bind和c.Request.For... 目录一、GET表单处理二、POST表单处理1. 使用c.PostForm获取表单字段:2. 绑定到结

javaScript在表单提交时获取表单数据的示例代码

《javaScript在表单提交时获取表单数据的示例代码》本文介绍了五种在JavaScript中获取表单数据的方法:使用FormData对象、手动提取表单数据、使用querySelector获取单个字... 方法 1:使用 FormData 对象FormData 是一个方便的内置对象,用于获取表单中的键值

C#提取PDF表单数据的实现流程

《C#提取PDF表单数据的实现流程》PDF表单是一种常见的数据收集工具,广泛应用于调查问卷、业务合同等场景,凭借出色的跨平台兼容性和标准化特点,PDF表单在各行各业中得到了广泛应用,本文将探讨如何使用... 目录引言使用工具C# 提取多个PDF表单域的数据C# 提取特定PDF表单域的数据引言PDF表单是一

HTML提交表单给python

python 代码 from flask import Flask, request, render_template, redirect, url_forapp = Flask(__name__)@app.route('/')def form():# 渲染表单页面return render_template('./index.html')@app.route('/submit_form',

form表单提交编码的问题

浏览器在form提交后,会生成一个HTTP的头部信息"content-type",标准规定其形式为Content-type: application/x-www-form-urlencoded; charset=UTF-8        那么我们如果需要修改编码,不使用默认的,那么可以如下这样操作修改编码,来满足需求: hmtl代码:   <meta http-equiv="Conte

js异步提交form表单的解决方案

1.定义异步提交表单的方法 (通用方法) /*** 异步提交form表单* @param options {form:form表单元素,success:执行成功后处理函数}* <span style="color:#ff0000;"><strong>@注意 后台接收参数要解码否则中文会导致乱码 如:URLDecoder.decode(param,"UTF-8")</strong></span>

前端form表单+ifarme方式实现大文件下载

// main.jsimport Vue from 'vue';import App from './App.vue';import { downloadTokenFile } from '@/path/to/your/function'; // 替换为您的函数路径// 将 downloadTokenFile 添加到 Vue 原型上Vue.prototype.$downloadTokenF

react笔记 8-21 约束性 表单

1、约束性组件和非约束性组件 非约束性组件<input type="text" name="" defaultValue={this.state.msg}></input>这里他的value是用户输入的值 并没有执行操作 只是获取到了msg的值 用户输入不会改变数据非约束性组件需要使用defaultValue获取数据 否则会报错约束性组件<input type="text