123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <script src="/js/jquery.validate.min.js"></script>
- <style>
- label{font-weight:100 !important;}
- </style>
- <script type="text/javascript">
- jQuery(function($) {
- $('#userInfoSubmit').validate({
- //debug:true,// 表单不会提交
- //errorElement: 'font', // 错误信息div
- errorClass: 'errorMessage', //错误样式
- ignore: "", //忽略提交字段
- onfocus: true,
- rules: {
- name:{
- required: true,
- },
- grade:{
- required: true,
- },
- class_id: {
- required: true,
- },
- },
- messages: {
- grade:{
- required: "请选择年级",
- },
- class_id: {
- required: "请选择班级!",
- },
- name:{
- required: "请输入考试名称",
- },
- },
- errorPlacement: function (error, element) { // 指定错误信息显示位置
- if(element.is('input[type=radio]')) {
- var controls = element.closest('div[class*="col-"]');
- if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
- else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
- }else{
- error.insertAfter(element.after());
- }
- },
- });
-
- var grade = jQuery("#grade").val();
- if(grade){
- jQuery.get(
- "<?php echo $this->createUrl("record/getgradeclassesjson");?>",
- {"grade": grade},
- function(data){
- if(data){
- data = JSON.parse(data);
- count = data.length;
- html = '<option value="">请选择</option>';
- for(i = 0; i < count; i++){
- html += '<option value="'+data[i].class_id+'">'+data[i].class_name+'</option>';
- }
-
- jQuery("#class_id").empty();
- jQuery("#class_id").append(html);
- }
- }
- );
- }
-
- jQuery("#grade").change(function(){
- var grade = jQuery(this).val();
-
- jQuery.get(
- "<?php echo $this->createUrl("record/getgradeclassesjson");?>",
- {"grade": grade},
- function(data){
- if(data){
- data = JSON.parse(data);
- count = data.length;
- html = '<option value="">请选择</option>';
- for(i = 0; i < count; i++){
- html += '<option value="'+data[i].class_id+'">'+data[i].class_name+'</option>';
- }
-
- jQuery("#class_id").empty();
- jQuery("#class_id").append(html);
- }
- }
- );
- });
- });
- </script>
- <div class="main-content-inner">
- <div class="breadcrumbs" id="breadcrumbs">
- <ul class="clearfix main-content-inner-ul">
- </ul>
- </div>
- <div class="page-content" style="margin-top:15px">
- <div class="row marginNo">
- <div class="col-xs-12 fontSize1">
- <!-- PAGE CONTENT BEGINS -->
- <form class="form-horizontal" action="<?php echo $this->createUrl('record/addact');?>" method="post" enctype="multipart/form-data" id="userInfoSubmit">
- <input type="hidden" name="exam_id" value="<?php echo $exam ? $exam["exam_id"] : "";?>" />
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">考试名称<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9 mtCentent">
- <input type="text" name="name" style="height:30px;" value="<?php echo $exam ? $exam["name"] : "";?>" class="col-xs-10 col-sm-2 addborder addheight marginLeftNo">
- </div>
- </div>
-
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">所属年级<span class="errorMessage">*</span>:</label>
- <div class="col-xs-12 col-sm-9">
- <div class="clearfix">
- <select class="col-xs-10 col-sm-2 addborder addheight marginLeftNo input-medium" name="grade" id="grade">
- <option value="">请选择</option>
- <option value="1">高一</option>
- <option value="2">高二</option>
- <option value="3">高三</option>
- </select>
- </div>
- </div>
- </div>
-
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">所属班级<span class="errorMessage">*</span>:</label>
- <div class="col-xs-12 col-sm-9">
- <div class="clearfix">
- <select class="col-xs-10 col-sm-2 addborder addheight marginLeftNo input-medium " id="class_id" name="class_id">
- <option value="">请选择</option>
- </select>
- </div>
- </div>
- </div>
-
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">上传Excel<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9">
- <input type="file" id="exname" name="exname" class="col-xs-10 col-sm-3">
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right"></label>
- <div style="margin-top:8px" class="col-sm-9">
- <a href="/assets/data/导入成绩示例.xls" target="_blank" class="col-xs-10 col-sm-3">下载Excel表格示例</a>
- </div>
- </div>
- <div class="clearfix form-actions">
- <div class="col-md-offset-3 col-md-9">
- <button class="btn btn-success btn-sm" type="submit" id="schoolSubmit">
- <i class="ace-icon fa fa-check bigger-110"></i> 提交
- </button>
-
- <!---
- <button class="btn" type="reset">
- <i class="ace-icon fa fa-undo bigger-110"></i>
- 重填
- </button>
- ---->
- </div>
- </div>
- </form>
- <!-- PAGE CONTENT ENDS -->
- </div>
- </div>
- </div>
- </div>
|