form表单提交时选择性传值到后台
正常情况下form表单提交会把表单内的内容提交到后台,但是如果有些内容只是作为展示或者是标记而不想传到后台,我们采用如下方法:
jsp页面如下,我们不想提交id为userIdMark和pwdMark的input框的值到后台,所以我们需要在提交时设置input框的属性为disabled,
这样当表单提交时,他们的值就无法提交到后台,从而达到目的
<form action="${path }/manage/logon.do" method="post" id="logonForm">
<table cellpadding="0" cellspacing="0" border="0">
<tr height="50">
<td>
<input type="text" id="userIdMark" name="userIdMark" style="line-height:20px; height:20px;width: 150px;"/>
<input type="hidden" id="userId" name="userId" style="line-height:20px; height:20px;width: 150px;"/>
</td>
</tr>
<tr height="50">
<td>
<input type="password" id="pwdMark" name="pwdMark" style="line-height:20px; height:20px;width: 150px;"/>
<input type="hidden" id="pwd" name="pwd" style="line-height:20px; height:20px;width: 150px;"/>
</td>
</tr>
<tr height="60">
<td>
<a href="#" id="logon" name="submit" class="login_btn"></a>
</td>
</tr>
</table>
</form>
js代码:
$("#logon").click(function(){
document.getElementById("userId").value = "admin";
document.getElementById("pwd").value = "1";
$("#userIdMark").attr("disabled","disabled");
$("#pwdMark").attr("disabled","disabled");
$("#logonForm").submit();
});
这样后台就只能接收id为userId和pwd的的值,无法接收id为userIdMark和pwdMark的值了
form表单提交时选择性传值到后台的更多相关文章
- jQuery判断 form表单提交时一些文本框的判断
一: form表单提交时如果表单里有input标签为空那么不提交form表单. <head> <script type="text/javascript"> ...
- php form表单提交时,action url中参数无效的解决方法
表单提交时get方式的一个错误 <form class="form-inline pull-right" method="get" action=&quo ...
- springboot框架中集成thymeleaf引擎,使用form表单提交数据,debug结果后台获取不到数据
springboot框架中集成thymeleaf引擎,使用form表单提交数据,debug结果后台获取不到数据 表单html: <form class="form-horizontal ...
- 【教训】 form表单提交时,action url中参数无效
今天提交一个表单,内容参考如下: <form action="add.php?a=123&b=456"> <input type="hi ...
- form表单提交时,action怎么带参数
<html> <title>form</title> <script type="text/javascript"> functio ...
- form表单提交时action路劲问题
项目总出现window上部署可以访问,linux下部署不能访问的问题 linux下访问action必须是全路径,可以加上“${pageContext.request.contextPath}” 便可 ...
- form表单提交target属性使用
通过form表单提交刷新iframe <form action="doctor/selPackage" target="projectlistframe" ...
- 关于form表单提交ajaxForm和ajaxSubmit的用法与区别
前几天在学习form表单提交时看到这两种方法,这两种方法都是实现form的ajax提交的方法,看了很多资料还是不太明白其用法和区别,最后直接自己写demo,很快就理解,所以说实操是学习的最快捷直接的途 ...
- SpringMVC中使用bean来接收form表单提交的参数时的注意点
这是前辈们对于SpringMVC接收表单数据记录下来的总结经验: SpringMVC接收页面表单参数 springmvc请求参数获取的几种方法 下面是我自己在使用时发现的,前辈们没有记录的细节和注意点 ...
随机推荐
- hdu 1130,hdu 1131(卡特兰数,大数)
How Many Trees? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- Single Number I&& II——还没看,倒过头来再看
Single Number I Given an array of integers, every element appears twice except for one. Find that si ...
- bootstrap3中container与container_fluid容器的区别
声明:转自 CSDN博客 .container与.container_fluid是bootstrap中的两种不同类型的外层容器,按照官方的说法,这两者的区别是: .container 类用于固定宽度并 ...
- PHP PDO类 单例
<?php /*//pdo连接信息 $pdo=array("mysql:host=localhost;dbname=demo;charset=utf8","root ...
- php详解和优化
nginx结合php使用FastCGI方式 apache结合php,php是作为一个模块加载到apache中 (1)FastCGI工作原理 1.用户发送http请求报文给nginx服务器 2.ngin ...
- 【javascript】基于javascript的小时钟
计时事件:通过JavaScript,我们可以设置在一段时间间隔后执行一段代码,而不仅仅是在函数调用后立即执行. 在JavaScript中,使用计时事件是很容易的,主要有两个事件供我们使用 setTim ...
- 欧拉图 欧拉回路 欧拉通路 Euler
欧拉图 本文链接:http://www.cnblogs.com/Ash-ly/p/5397702.html 定义: 欧拉回路:图G的一个回路,如果恰通过图G的每一条边,则该回路称为欧拉回路,具有欧拉回 ...
- Android Theme.AppCompat.Light的解决方法
styles.xml中<style name="AppBaseTheme" parent="Theme.AppCompat.Light">提示如下错 ...
- Poj3580 Super Memo(FHQ-Treap)
题面 题解 对于操作$1$,我们可以对于每个节点打一个$add$标记,下放就行了 对于操作2,可以参考这篇题解的上一篇,不赘述 对于操作4,可以将区间裂成两部分,然后再插入合并 对于操作5,可以将区间 ...
- Number Sequence HDU - 5014
There is a special number sequence which has n+1 integers. For each number in sequence, we have two ...