edit.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <script src="/js/jquery.validate.min.js"></script>
  2. <style>
  3. label{font-weight:100 !important;}
  4. </style>
  5. <script type="text/javascript">
  6. jQuery(function($) {
  7. $('#userInfoSubmit').validate({
  8. //debug:true,// 表单不会提交
  9. //errorElement: 'font', // 错误信息div
  10. errorClass: 'errorMessage', //错误样式
  11. ignore: "", //忽略提交字段
  12. onfocus: true,
  13. rules: {
  14. name:{
  15. required: true,
  16. },
  17. grade:{
  18. required: true,
  19. },
  20. class_id: {
  21. required: true,
  22. },
  23. },
  24. messages: {
  25. grade:{
  26. required: "请选择年级",
  27. },
  28. class_id: {
  29. required: "请选择班级!",
  30. },
  31. name:{
  32. required: "请输入考试名称",
  33. },
  34. },
  35. errorPlacement: function (error, element) { // 指定错误信息显示位置
  36. if(element.is('input[type=radio]')) {
  37. var controls = element.closest('div[class*="col-"]');
  38. if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
  39. else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
  40. }else{
  41. error.insertAfter(element.after());
  42. }
  43. },
  44. });
  45. var grade = jQuery("#grade").val();
  46. if(grade){
  47. jQuery.get(
  48. "<?php echo $this->createUrl("record/getgradeclassesjson");?>",
  49. {"grade": grade},
  50. function(data){
  51. if(data){
  52. data = JSON.parse(data);
  53. count = data.length;
  54. html = '<option value="">请选择</option>';
  55. for(i = 0; i < count; i++){
  56. html += '<option value="'+data[i].class_id+'">'+data[i].class_name+'</option>';
  57. }
  58. jQuery("#class_id").empty();
  59. jQuery("#class_id").append(html);
  60. }
  61. }
  62. );
  63. }
  64. jQuery("#grade").change(function(){
  65. var grade = jQuery(this).val();
  66. jQuery.get(
  67. "<?php echo $this->createUrl("record/getgradeclassesjson");?>",
  68. {"grade": grade},
  69. function(data){
  70. if(data){
  71. data = JSON.parse(data);
  72. count = data.length;
  73. html = '<option value="">请选择</option>';
  74. for(i = 0; i < count; i++){
  75. html += '<option value="'+data[i].class_id+'">'+data[i].class_name+'</option>';
  76. }
  77. jQuery("#class_id").empty();
  78. jQuery("#class_id").append(html);
  79. }
  80. }
  81. );
  82. });
  83. });
  84. </script>
  85. <div class="main-content-inner">
  86. <div class="breadcrumbs" id="breadcrumbs">
  87. <ul class="clearfix main-content-inner-ul">
  88. </ul>
  89. </div>
  90. <div class="page-content" style="margin-top:15px">
  91. <div class="row marginNo">
  92. <div class="col-xs-12 fontSize1">
  93. <!-- PAGE CONTENT BEGINS -->
  94. <form class="form-horizontal" action="<?php echo $this->createUrl('record/addact');?>" method="post" enctype="multipart/form-data" id="userInfoSubmit">
  95. <input type="hidden" name="exam_id" value="<?php echo $exam ? $exam["exam_id"] : "";?>" />
  96. <div class="form-group">
  97. <label class="control-label col-xs-12 col-sm-3 no-padding-right">考试名称<span class="errorMessage">*</span>:</label>
  98. <div class="col-sm-9 mtCentent">
  99. <input type="text" name="name" style="height:30px;" value="<?php echo $exam ? $exam["name"] : "";?>" class="col-xs-10 col-sm-2 addborder addheight marginLeftNo">
  100. </div>
  101. </div>
  102. <div class="form-group">
  103. <label class="control-label col-xs-12 col-sm-3 no-padding-right">所属年级<span class="errorMessage">*</span>:</label>
  104. <div class="col-xs-12 col-sm-9">
  105. <div class="clearfix">
  106. <select class="col-xs-10 col-sm-2 addborder addheight marginLeftNo input-medium" name="grade" id="grade">
  107. <option value="">请选择</option>
  108. <option value="1">高一</option>
  109. <option value="2">高二</option>
  110. <option value="3">高三</option>
  111. </select>
  112. </div>
  113. </div>
  114. </div>
  115. <div class="form-group">
  116. <label class="control-label col-xs-12 col-sm-3 no-padding-right">所属班级<span class="errorMessage">*</span>:</label>
  117. <div class="col-xs-12 col-sm-9">
  118. <div class="clearfix">
  119. <select class="col-xs-10 col-sm-2 addborder addheight marginLeftNo input-medium " id="class_id" name="class_id">
  120. <option value="">请选择</option>
  121. </select>
  122. </div>
  123. </div>
  124. </div>
  125. <div class="form-group">
  126. <label class="control-label col-xs-12 col-sm-3 no-padding-right">上传Excel<span class="errorMessage">*</span>:</label>
  127. <div class="col-sm-9">
  128. <input type="file" id="exname" name="exname" class="col-xs-10 col-sm-3">
  129. </div>
  130. </div>
  131. <div class="form-group">
  132. <label class="control-label col-xs-12 col-sm-3 no-padding-right"></label>
  133. <div style="margin-top:8px" class="col-sm-9">
  134. <a href="/assets/data/导入成绩示例.xls" target="_blank" class="col-xs-10 col-sm-3">下载Excel表格示例</a>
  135. </div>
  136. </div>
  137. <div class="clearfix form-actions">
  138. <div class="col-md-offset-3 col-md-9">
  139. <button class="btn btn-success btn-sm" type="submit" id="schoolSubmit">
  140. <i class="ace-icon fa fa-check bigger-110"></i> 提交
  141. </button>
  142. &nbsp; &nbsp; &nbsp;
  143. <!---
  144. <button class="btn" type="reset">
  145. <i class="ace-icon fa fa-undo bigger-110"></i>
  146. 重填
  147. </button>
  148. ---->
  149. </div>
  150. </div>
  151. </form>
  152. <!-- PAGE CONTENT ENDS -->
  153. </div>
  154. </div>
  155. </div>
  156. </div>