Pārlūkot izejas kodu

解决4485 【PC随访】随访,数字框应限制负数输入

raolu 7 gadi atpakaļ
vecāks
revīzija
5f6aac1f86
2 mainītis faili ar 12 papildinājumiem un 1 dzēšanām
  1. 11 0
      js/buz/followup/questionaires.js
  2. 1 1
      page/followup/questionaires.html

+ 11 - 0
js/buz/followup/questionaires.js

@ -449,6 +449,11 @@ function submitForm(){
function bindEvents(){
function bindEvents(){
    //监听表单数据信息变化
    //监听表单数据信息变化
    $("#question_form").on("change", "input", function(){
    $("#question_form").on("change", "input", function(){
        //先判断数字键盘不能输入负数
        var textType = $(this).attr("type");
        if(textType == "number"){
            this.value = this.value.replace(/\-/g,"");
        }
        checkBtnEnable();
        checkBtnEnable();
        
        
        var name = $(this).attr("name");
        var name = $(this).attr("name");
@ -473,6 +478,12 @@ function bindEvents(){
        }
        }
    });
    });
    
    
    $("#question_form").on("keypress", "input[type=number]", function(event){
        if(event.keyCode == 45){
            event.preventDefault();
        }
    })
    
    //监听下拉框的变化
    //监听下拉框的变化
    $("#question_form").on("change", "select", function(){
    $("#question_form").on("change", "select", function(){
        checkBtnEnable();
        checkBtnEnable();

+ 1 - 1
page/followup/questionaires.html

@ -67,7 +67,7 @@
                <input type="text" name="{{key}}" id="{{key}}" value="{{it.value}}" {{if it.readonly}}readonly="{{it.readonly}}"{{/if}}class="form-control input-xs" style="width: {{it.width}};"/>
                <input type="text" name="{{key}}" id="{{key}}" value="{{it.value}}" {{if it.readonly}}readonly="{{it.readonly}}"{{/if}}class="form-control input-xs" style="width: {{it.width}};"/>
                {{/if}}
                {{/if}}
                {{if it.textType == 'number'}}
                {{if it.textType == 'number'}}
                <input type="number" name="{{key}}" id="{{key}}" value="{{it.value}}" step="{{it.step}}" class="form-control input-xs" style="width: {{it.width}};"/>
                <input type="number" name="{{key}}" id="{{key}}" value="{{it.value}}" step="{{it.step}}" min="0" class="form-control input-xs" style="width: {{it.width}};"/>
                {{/if}}
                {{/if}}
                {{if it.textType == 'date'}}
                {{if it.textType == 'date'}}
                <div class="input-group date" style="width:200px">
                <div class="input-group date" style="width:200px">