根据class 属性判断所有的文本框必填
<body>
<!-- 遮罩层 -->
<div id="hidediv"
style="width: 100%;height: 100%;background-color: #808080;z-index: 99999;display: none;opacity:0.5;position: absolute;"></div>
<div id="main_login">
<s:include value="../../top.jsp">
<s:param name="menuTitle">兼职人员工资结算方式-编辑</s:param>
</s:include>
<div class="content_login">
<div class="line_bottom padding_style1">
<a href="javascript:history.back(-1)"><i class="icon-backward"></i>
返回</a>
</div>
<s:form id="form" action="%{#request['struts.actionMapping'].name}"
theme="bootstrap" cssClass="form-horizontal m_top col-md-8">
<s:hidden name="id"></s:hidden>
<input type="hidden" id="ceoId" name="ceoId" value="${ceo }"/>
<input type="hidden" id="riderId" name="riderId" value="${rider }">
<input type="hidden" id="type" name="type" value="${ceoCommissionType }">
<!-- 工资结算方式(骑手/楼长) -->
<c:if test="${rider eq 1 }">
<div class="control-group form-group">
<label for="工资结算方式" class="col-md-2 control-label">工资结算方式(骑手/楼长)</label>
<div class="col-md-9 checkbox checkbox-inline">
<label class="radio-inline"><input type="radio" name="commissionType" <s:if test="commissionType == 1">checked="checked"</s:if> value="1" onclick="riderChoose('1')"/>配送费分成</label>
<label class="radio-inline"><input type="radio" name="commissionType" <s:if test="commissionType == 2">checked="checked"</s:if> value="2" onclick="riderChoose('2')"/>营业额百分比分成</label>
<label class="radio-inline"><input type="radio" name="commissionType" <s:if test="commissionType == 3">checked="checked"</s:if> value="3" onclick="riderChoose('3')"/>配送费+营业额百分比分成</label>
</div>
</div> <div class="control-group form-group" id="distributionId" style="display: none;">
<label class="col-md-2 control-label">配送费分成(单位:%)</label>
<div class="col-md-9">
<input type="text" name="distributionPercent" value="${distributionPercent}" class="form-control" style="width: 100px"/>
<span class="help-block"><span class="label"></span></span>
<div class="controls"></div>
</div>
</div>
<div class="control-group form-group" id="stallsuctionId" style="display:none;">
<label class="col-md-2 control-label">营业额百分比分成(单位:%)</label>
<div class="col-md-9">
<c:choose>
<c:when test="${!empty riderList }">
<c:forEach items="${riderList }" var="rider" begin="0" varStatus="status">
<c:set value="${status.count-1 }" var="num"></c:set>
<div class="stall_money_rider_percent">
<input type="text" id="riderSettlementList[${num}].percent" name="riderSettlementList[${num}].percent" value="${rider.percent}" class="form-control stall_percent" style="width: 100px"/>${rider.stallName }
<input type="hidden" id="riderSettlementList[${num}].stallId" name="riderSettlementList[${num}].stallId" value="${rider.stallId }">
</div>
</c:forEach>
</c:when>
<c:otherwise>
<c:forEach items="${stallList }" var="stall" begin="0" varStatus="status">
<c:set value="${status.count-1 }" var="num"></c:set>
<div class="stall_money_rider_percent">
<input type="text" id="riderSettlementList[${num}].percent" name="riderSettlementList[${num}].percent" value="" class="form-control stall_percent" style="width: 100px"/>${stall.name }
<input type="hidden" id="riderSettlementList[${num}].stallId" name="riderSettlementList[${num}].stallId" value="${stall.id }">
</div>
</c:forEach>
</c:otherwise>
</c:choose>
</div>
</div>
</c:if> <!-- 工资结算方式(校园CEO) ceo抽佣方式:1:档口营业额分成,2:档口订单分成-->
<c:if test="${ceo eq 2 }">
<div class="control-group form-group">
<label for="工资结算方式" class="col-md-2 control-label">工资结算方式(校园CEO)</label>
<div class="col-md-9 checkbox checkbox-inline">
<label class="radio-inline"><input type="radio" name="ceoCommissionType" <s:if test="ceoCommissionType == 1">checked="checked"</s:if> value="1" onclick="ceoChoose('1')"/>营业额百分比分成</label>
<label class="radio-inline"><input type="radio" name="ceoCommissionType" <s:if test="ceoCommissionType == 2">checked="checked"</s:if> value="2" onclick="ceoChoose('2')"/>营业额订单固定分成</label>
</div>
</div>
<div class="control-group form-group" id="dividedIntoId" style="display: none;">
<label class="col-md-2 control-label">营业额订单固定分成(单位:元)</label>
<div class="col-md-9">
<c:choose>
<c:when test="${!empty ceoList }">
<c:forEach items="${ceoList }" var="ceo" begin="0" varStatus="status">
<c:set value="${status.count-1 }" var="num"></c:set>
<div class="stall_money_ceo_money">
<input type="text" id="ceoOrderSettlementList[${num}].money" name="ceoOrderSettlementList[${num}].money" value="${ceo.money}" class="form-control stall_money" style="width: 100px"/>${ceo.stallName }
<input type="hidden" id="ceoOrderSettlementList[${num}].stallId" name="ceoOrderSettlementList[${num}].stallId" value="${ceo.stallId }">
</div>
</c:forEach>
</c:when>
<c:otherwise>
<c:forEach items="${stallList }" var="stall" begin="0" varStatus="status">
<c:set value="${status.count-1 }" var="num"></c:set>
<div class="stall_money_ceo_money">
<input type="text" id="ceoOrderSettlementList[${num}].money" name="ceoOrderSettlementList[${num}].money" value="" class="form-control stall_money" style="width: 100px"/>${stall.name }
<input type="hidden" id="ceoOrderSettlementList[${num}].stallId" name="ceoOrderSettlementList[${num}].stallId" value="${stall.id }">
</div>
</c:forEach>
</c:otherwise>
</c:choose>
</div>
</div>
<div class="control-group form-group" id="turnoverId" style="display: none;">
<label class="col-md-2 control-label">营业额百分比分成(单位:%)</label>
<div class="col-md-9">
<c:choose>
<c:when test="${!empty ceoList }">
<c:forEach items="${ceoList }" var="ceo" begin="0" varStatus="status">
<c:set value="${status.count-1 }" var="num"></c:set>
<div class="stall_money_ceo_percent">
<input type="text" id="ceoSettlementList[${num}].percent" name="ceoSettlementList[${num}].percent" value="${ceo.percent}" class="form-control stall_percent" style="width: 100px"/>${ceo.stallName }
<input type="hidden" id="ceoSettlementList[${num}].stallId" name="ceoSettlementList[${num}].stallId" value="${ceo.stallId }"/>
</div>
</c:forEach>
</c:when>
<c:otherwise>
<c:forEach items="${stallList }" var="stall" begin="0" varStatus="status">
<c:set value="${status.count-1 }" var="num"></c:set>
<div class="stall_money_ceo_percent">
<input type="text" id="ceoSettlementList[${num}].percent" name="ceoSettlementList[${num}].percent" value="" class="form-control stall_percent" style="width: 100px"/>${stall.name }
<input type="hidden" id="ceoSettlementList[${num}].stallId" name="ceoSettlementList[${num}].stallId" value="${stall.id }"/>
</div>
</c:forEach>
</c:otherwise>
</c:choose>
</div>
</div>
</c:if> <div class="col-md-offset-2">
<a id="subUpdate" class="btn btn-default" style="margin-left: 80px;">保存</a>
</div>
</s:form>
</div>
</body>
js
var type = $('input[name="type"]').val();
//骑手楼长营业额百分比分成
var flag = false;
$(".stall_money_rider_percent").each(function(){
var value = $(this).find(".stall_percent").val();
if(value==null || value==""){
flag=true;
return false;
}
});
if(flag){
alert('骑手楼长营业额百分比分成必填');
return;
}
//ceo营业额百分比分成
if(type==1){
$(".stall_money_ceo_percent").each(function(){
var value = $(this).find(".stall_percent").val();
if(value==null || value==""){
flag=true;
return false;
}
})
if(flag){
alert('ceo营业额百分比分成必填')
return;
}
}
//ceo营业额订单固定分成必填
if(type==2){
$(".stall_money_ceo_money").each(function(){
var value = $(this).find(".stall_money").val();
if(value==null || value==""){
flag = true;
return false;
}
});
if(flag){
alert('ceo营业额订单固定分成必填');
return;
}
}
根据class 属性判断所有的文本框必填的更多相关文章
- Enterprise Library +Caliburn.Micro+WPF CM框架下使用企业库验证,验证某一个属性,整个页面的文本框都变红的原因
我用的是CM这个框架做的WPF,在用企业库的验证的时候,我用标签的方式给一个属性加了不能为空的验证,但整个页面的所有控件的外面框都变红了.原因是CM框架的绑定方式是直接X:Name="你的属 ...
- ASP.NET、WinForm - 判断整个页面文本框是否为空
foreach(Control ctrl in Page.Controls) { foreach(Control childc in ctrl.Controls) { switch(childc.Ge ...
- 验证页面多个input文本的必填项
前台页面 JS : function CheckMustWrite(){ var count = $("input[mustwrite = 'true']", document.f ...
- input文本框禁止修改文本——disabled和readonly属性的作用及区别
1.input文本框禁止修改文本 disabled属性:<input type="text" name="name" value="xxx&qu ...
- 【kindeditor】KindEditor获取多个textarea文本框的值并判断非空
kindeditor官网:http://kindeditor.net/demo.php 如何获取多个KindEditor中textarea文本框的值,方式很多种(带有HTML标签). var intr ...
- js/jquery获取文本框的值与改变文本框的值
我们就用它来学习获取文本框的值及改变文本框的值. 代码如下 复制代码 <script>function get1(){ document.getElementById("txtb ...
- 使用 Windows 窗体 TextBox 控件创建密码文本框
密码框是一种 Windows 窗体文本框,它在用户键入字符串时显示占位符. 创建密码文本框 将 TextBox 控件的 PasswordChar 属性设置为某个特定字符. PasswordChar 属 ...
- PDF文本框更改字体大小
在Adobe Acrobat Professional 7.0版本后里单击所插入的文本框,会出现文本框属性,此时只能改文本框的属性,不能修改文本框内的字体大小 要改字体很简单,左键选中要改的文本,按 ...
- 文本框input:text
文本框 CreateTime--2017年4月24日10:40:40 Author:Marydon 一.文本框 (一)标签 <input type="text"/> ...
随机推荐
- P1216 [IOI1994]数字三角形
史上最水的 dp 题,没有之一(By rxz) 确实很简单,就算是我这个 dp 萌新也一眼看出来了转移方程 首先考虑状态,设 \(f_{i,j}\) 表示选择第 \(i\) 层第 \(j\) 个数时获 ...
- Codeforces Round #624 (Div. 3) C. Perform the Combo(前缀和)
You want to perform the combo on your opponent in one popular fighting game. The combo is the string ...
- 每天进步一点点------altium designer 实用的快捷键
1.设计浏览器快捷键: 鼠标左击 选择鼠标位置的文档鼠标双击 编辑鼠标位置的文档鼠标右击 ...
- springboot的安装与初步使用
1.引用springboot框架 1.在maven项目底下的pom.xml的中,引用springboot,如下 <?xml version="1.0" encoding=&q ...
- ioutils
import yaml import json import csv import configparser class IoUtils(object): """ dep ...
- [AST Babel Plugin] Transform code, add line:column number for console log
For example we have current code: function add(a, b) { console.log(a, b) return a + b } function sub ...
- X-Frame-Options报错处理
项目中用到iframe嵌入网页,因为是前后端分离的,所以前端会报错Refused to display ‘网址' in a frame because it set 'X-Frame-Options' ...
- php 基础 字符型转换整形
示例: 可以得出规律:以有效数字开头的,取有效数字.以非有效数字开头的都转换为0:
- Dockerfile文档编写
图片显示问题,附上有道云笔记中链接:http://note.youdao.com/noteshare?id=fba6d2f53fd6447ba32c3b7accfeb89b&sub=B36B5 ...
- linux下删除文件夹
---恢复内容开始--- 4月份左右接触linux,一直到现在,收获不多,原因是因为我没有足够的努力,其实这段时间以来我也很自责. 今天学习linux进程调度等知识,使用小红帽时,准备删除一个无用的文 ...