根据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"/> ...
随机推荐
- C#对字典Dictionary 的添加,遍历,移除系列操作
C#对字典Dictionary 的添加,遍历,移除系列操作: //一.创建泛型哈希表,然后加入元素 Dictionary<string, string> oscar = new Dicti ...
- 网关集成Swagger出现404错误
原因是忘了在需要生成api的类上加入注解 @EnableSwagger2Doc
- php对字符串的操作
php最文字的处理很是强大,之前一直云里雾里,这次学习一下. 1,' 与 ”的区别 <?php //双引号中的特殊字符会被解析 echo "你好\t我好";echo &quo ...
- XSS 4
第四题 进去后是这个样子的 然后我们随便输入第三题中的数据发现 不可以运行 看一下右边 发现()被替换成空内容 然后我们改一下 括号可以用倒引号替换 然后我们改一下 然后就通过了 原因:这个题是有关 ...
- 解决laravel出现Syntax error or access violation: 1055 '***' isn't in GROUP BY
laravel 5.3 以后默认开启 mysql严格模式(strict)在mysql在严格模式下, 并且开启了ONLY_FULL_GROUP_BY的情况下,group by 的字段没有出现在 sele ...
- token是个什么东西?怎样生成并携带token
什么是token及怎样生成token 转载自:https://www.cnblogs.com/lufeiludaima/p/pz20190203.html 什么是token Token是服务端生成的 ...
- 那些年做过的ctf之加密篇(加强版)
MarkdownPad Document *:first-child { margin-top: 0 !important; } body>*:last-child { margin-botto ...
- itest(爱测试) 4.3.0 发布,开源BUG 跟踪管理 & 敏捷测试管理软件
itest 简介:查看简介 test 开源敏捷测试管理,testOps 践行者.可按测试包分配测试用例执行,也可建测试迭代(含任务,测试包,BUG)来组织测试工作,也有测试环境管理,还有很常用的测试度 ...
- Unknown failure (Failure - not installed for 0) 、Error while Installing APKs
解决方法一: 设置 -> 更多设置 -> 开发者选项 ->关闭启用MIUI优化 解决方法二:(这种方法就用不了apply changes的功能了) 描述:在一些机型上安装软件 提示卸 ...
- opencv python:Canny边缘提取
Canny是边缘提取算法,在1986年提出的 是一个很好的边缘检测器 Canny算法介绍 非最大信号抑制: 高低阈值连接: example import cv2 as cv import numpy ...