Browse Source

多项填空题实现最少答几题限制

keyuan 4 years ago
parent
commit
e0b983a6fd

+ 1 - 0
src/main/webapp/WEB-INF/page/content/diaowen-design/answer-survey-m.jsp

@@ -318,6 +318,7 @@
 								<input type="hidden" class="quId" value="${en.id }">
 								<input type="hidden" class="orderById" value="${en.orderById }"/>
 								<input type="hidden" class="isRequired" value="${en.isRequired }">
+								<input type="hidden" class="paramInt01" value="${en.paramInt01 }">
 								<div class="quLogicInputCase">
 									<c:forEach items="${en.questionLogics }" var="quLogicEn" varStatus="logicSts">
 									<div class="quLogicItem quLogicItem_${logicSts.count }">

+ 1 - 0
src/main/webapp/WEB-INF/page/content/diaowen-design/answer-survey-p.jsp

@@ -489,6 +489,7 @@ label.error{
 								<input type="hidden" class="quId" value="${en.id }">
 								<input type="hidden" class="orderById" value="${en.orderById }"/>
 								<input type="hidden" class="isRequired" value="${en.isRequired }">
+								<input type="hidden" class="paramInt01" value="${en.paramInt01 }">
 								<div class="quLogicInputCase">
 									<c:forEach items="${en.questionLogics }" var="quLogicEn" varStatus="logicSts">
 									<div class="quLogicItem quLogicItem_${logicSts.count }">

+ 20 - 3
src/main/webapp/js/common/ans-m.js

@@ -171,14 +171,31 @@ $(document).ready(function(){
 
                 validateStatus=true;
                 var quScoreOptionTrs=quItemBody.find(".mFillblankTableTr");
+                var paramInt01=quItemBody.find(".paramInt01");
+                var anNum = 0;
                 $.each(quScoreOptionTrs,function(){
                     var scoreNumInput=$(this).find(".dwMFillblankInput");
-                    if(scoreNumInput.val()===""){
-                        validateStatus=false;
-                        return false;
+                    if(scoreNumInput.val()!=""){
+                        anNum++;
                     }
                 });
 
+                if(paramInt01[0]){
+                    if(paramInt01.val()=='0'){
+                        if(anNum!=quScoreOptionTrs.size()) {
+                            validateStatus = false;
+                        }
+                    }else{
+                        if(anNum<parseInt(paramInt01.val())) {
+                            validateStatus = false;
+                        }
+                    }
+                }else{
+                    if(anNum!=quScoreOptionTrs.size()) {
+                        validateStatus = false;
+                    }
+                }
+
             }else if(quType==="SCORE"){
 
                 validateStatus=true;

+ 20 - 3
src/main/webapp/js/common/ans-p.js

@@ -263,14 +263,31 @@ $(document).ready(function(){
 
                 validateStatus=true;
                 var quScoreOptionTrs=quItemBody.find(".mFillblankTableTr");
+                var paramInt01=quItemBody.find(".paramInt01");
+                var anNum = 0;
                 $.each(quScoreOptionTrs,function(){
                     var scoreNumInput=$(this).find(".dwMFillblankInput");
-                    if(scoreNumInput.val()===""){
-                        validateStatus=false;
-                        return false;
+                    if(scoreNumInput.val()!=""){
+                        anNum++;
                     }
                 });
 
+                if(paramInt01[0]){
+                    if(paramInt01.val()=='0'){
+                        if(anNum!=quScoreOptionTrs.size()) {
+                            validateStatus = false;
+                        }
+                    }else{
+                        if(anNum<parseInt(paramInt01.val())) {
+                            validateStatus = false;
+                        }
+                    }
+                }else{
+                    if(anNum!=quScoreOptionTrs.size()) {
+                        validateStatus = false;
+                    }
+                }
+
             }else if(quType==="SCORE"){
 
                 validateStatus=true;