3
13693261870
2022-09-16 63ba114e70e380442fcbed4a5157ee52c9491216
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 
window.onload = function() {
    jQuery.metadata.setType("attr", "validate");
    vm.form1 = jQuery('#valuefrom');
    vm.form1.validate({
        errorElement: 'span', //default input error message container
        errorClass: 'help-inline', // default input error message class
        focusInvalid: false, // do not focus the last invalid input
        ignore: "",
        errorPlacement: function(label, element) {
            //单个验证错误提示
            jQuery(element).parent('.input-icon').find('span').attr("title", label.html());
            jQuery(element).parent('.input-icon').find('span').addClass("fa fa-exclamation-triangle");
        },
 
        invalidHandler: function(event, validator) { //display error alert on form submit
            //App.scrollTo(error2, -200);
        },
        highlight: function(element) { // highlight error inputs                    
            element.style.borderColor = "#b94a48";
            jQuery(element).parent('.input-icon').find("i").removeClass("icon-ok").addClass("icon-exclamation-sign");
            jQuery(element).parent('.input-icon').find("i").css("display", "block");
        },
 
        unhighlight: function(element) { // revert the change done by highlight
            element.style.borderColor = "";
            jQuery(element)
                .closest('.control-group').removeClass('error'); // set error class to the control group
            jQuery(element).parent('.input-icon').find("i").removeClass("icon-exclamation-sign").addClass("icon-ok");
            jQuery(element).parent('.input-icon').find("i").css("display", "none");
        },
        success: function(label) {
            try {
                label
                    .addClass('valid').addClass('help-inline ok') // mark the current input as valid and display OK icon
                    .closest('.control-group').removeClass('error').addClass('success'); // set success class to the control group
                label.remove();
 
            } catch(e) {
 
            }
        },
        submitHandler: function(form) {
            vm.form1.submit();
        }
    });
 
}