<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>考试管理</title>
    <meta name="decorator" content="default"/>
    <%@include file="/WEB-INF/views/include/head.jsp" %>
</head>
<body>
<form:form id="inputForm" modelAttribute="student" action="${ctx}/admin/exam/student/save" method="post" class="form-horizontal">
    <form:hidden path="id"/>
    <tags:message content="${message}"/>
    <div class="control-group">
        <label class="control-label">科目</label>
        <div class="controls">
            <select id="subjectCode" name="subjectCode" <c:if test="${student.upload }">disabled="disabled"</c:if>>
                <c:forEach items="${subjectList }" var="subject">
                    <option value="${subject.code }" <c:if test="${student.subjectCode eq subject.code }">selected</c:if>>${subject.code}-${subject.name}</option>
                </c:forEach>
            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">姓名</label>
        <div class="controls">
            <form:input path="name" htmlEscape="false" maxlength="200" class="required"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">学号</label>
        <div class="controls">
            <form:input path="studentCode" htmlEscape="false" maxlength="200" class="required"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">准考证号</label>
        <div class="controls">
            <input name="examNumber" htmlEscape="false" maxlength="200" class="required"
                   <c:if test="${student.upload }">readonly="readonly"</c:if> value="${student.examNumber }"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">电厂</label>
        <div class="controls">
            <form:input path="college" htmlEscape="false" maxlength="200" class="required"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">机组</label>
        <div class="controls">
            <form:input path="className" htmlEscape="false" maxlength="200" class="required"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">总评</label>
        <div class="controls">
            <form:input path="teacher" htmlEscape="false" maxlength="200" class="required"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">签到表编号</label>
        <div class="controls">
            <form:input path="packageCode" htmlEscape="false" maxlength="200" class=""/>
        </div>
    </div>
    <div class="form-actions">
        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
        <a href="javascript:" onclick="history.go(-1);"  class="btn">返回</a>
    </div>
</form:form>
<script type="text/javascript">
    $(document).ready(function () {
        //$("#name").focus();
        $("#inputForm").validate({

            submitHandler: function (form) {
                //alert("studentId="+$("#studentId").val()+" subjectCode="+$("#subjectCode").val());
                $("#subjectCode").removeAttr("disabled");
               // $("#campusName").removeAttr("disabled");
                loading('正在提交，请稍等...');
                form.submit();
            },
            errorContainer: "#messageBox",
            errorPlacement: function (error, element) {
                $("#messageBox").text("输入有误，请先更正。");
                if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                    error.appendTo(element.parent().parent());
                } else {
                    error.insertAfter(element);
                }
            }
        });
    });
</script>
</body>
</html>