linzhijie
2021-04-12 c632636e2f5b4188b430f5efc9d9f68c8dbe3d6d
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增维度表')"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-subject-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">[[#{jsp.exam.subject.001}]]:</label>
            <div class="col-sm-8">
                <input name="name" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">[[#{jsp.exam.product.questionnaireType}]]:</label>
            <div class="col-sm-8">
                <select class="form-control" name="level" required>
                    <option value="">--[[#{jsp.exam.subject.002}]]--</option>
                    <optgroup th:with="levels=${@examLevel.selectTExamLevelList()}">
                        <option th:each="level : ${levels}" th:text="${level.levelName}"
                                th:value="${level.id}"></option>
                    </optgroup>
                </select>
                <div class="select-must" style="color: red" hidden="true">*[[#{jsp.exam.product.questionnaireType}]]</div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">[[#{jsp.exam.demographyParam.languagetype}]]:</label>
            <div class="col-sm-8">
                <select name="langType" class="form-control m-b"
                        th:with="type=${@dict.getType('lang_type')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-select-js"/>
<script type="text/javascript">
    var prefix = ctx + "exam/subject"
    $("#form-subject-add").validate({
        focusCleanup: true
    });
 
    function submitHandler() {
 
        $('select').each(function () {
            if ($(this).val() === "") {
                $(this).nextAll('.select-must').removeAttrs('hidden');
            }
        });
 
        if ($.validate.form()) {
 
            $('select').each(function () {
                if ($(this).val() === "") {
                    return;
                }
            });
 
            $.operate.save(prefix + "/add", $('#form-subject-add').serialize());
        }
    }
 
    $(function () {
        $('select').on("change", function () {
            $(this).nextAll('.select-must').attr('hidden','true');
        });
    });
</script>
</body>
</html>