edit.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <extend name="Public:base" />
  2. <block name="content">
  3. <div class="page-header">
  4. <h1>
  5. {$breadcrumb2}
  6. <small>
  7. <i class="icon-double-angle-right"></i>
  8. {$crumbs}
  9. </small>
  10. </h1>
  11. </div>
  12. <div class="row">
  13. <div class="col-xs-12">
  14. <form class="form-horizontal" id="validation-form" method="post" action='{$action}'>
  15. <notempty name="Think.get.id">
  16. <input name="weight_class_id" type="hidden" value="{$Think.get.id}" />
  17. </notempty>
  18. <div class="form-group">
  19. <label class="col-sm-1 control-label no-padding-left"> * 重量名称 </label>
  20. <div class="col-sm-11">
  21. <div class="clearfix">
  22. <input name="title" id="title" class="col-xs-10 col-sm-5" value="{$d.title|default=''}" type="text">
  23. </div>
  24. </div>
  25. </div>
  26. <div class="space-4"></div>
  27. <div class="form-group">
  28. <label class="col-sm-1 control-label no-padding-left"> *单位 </label>
  29. <div class="col-sm-11">
  30. <div class="clearfix">
  31. <input name="unit" id="unit" class="col-xs-10 col-sm-5" value="{$d.unit|default=''}" type="text">
  32. </div>
  33. </div>
  34. </div>
  35. <div class="space-4"></div>
  36. <div class="form-group">
  37. <label class="col-sm-1 control-label no-padding-left"> *值 </label>
  38. <div class="col-sm-11">
  39. <div class="clearfix">
  40. <input name="value" id="value" class="col-xs-10 col-sm-5" value="{$d.value|default=''}" type="text">
  41. </div>
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. <label class="col-sm-1 control-label no-padding-left"> </label>
  46. <div class="col-sm-11">
  47. <input name="send" type="submit" value="提交" class="btn btn-primary" />
  48. </div>
  49. </div>
  50. </form>
  51. </div>
  52. </div>
  53. </block>
  54. <block name="javascript">
  55. <script src="__JS__/jquery.validate.min.js"></script>
  56. <script>
  57. $(function(){
  58. $('#validation-form').validate({
  59. errorElement: 'div',
  60. errorClass: 'help-block',
  61. focusInvalid: false,
  62. rules: {
  63. title: {
  64. required: true,
  65. minlength: 1
  66. },
  67. unit: {
  68. required: true
  69. },
  70. value: {
  71. required: true
  72. }
  73. },
  74. messages: {
  75. title: {
  76. required: "必填",
  77. minlength: "不得少于1个字"
  78. },
  79. unit: {
  80. required: "必填"
  81. },
  82. value: {
  83. required: "必填"
  84. },
  85. },
  86. invalidHandler: function (event, validator) { //display error alert on form submit
  87. $('.alert-danger', $('.login-form')).show();
  88. },
  89. highlight: function (e) {
  90. $(e).closest('.form-group').removeClass('has-info').addClass('has-error');
  91. },
  92. success: function (e) {
  93. $(e).closest('.form-group').removeClass('has-error').addClass('has-info');
  94. $(e).remove();
  95. },
  96. errorPlacement: function (error, element) {
  97. error.insertAfter(element.parent());
  98. },
  99. });
  100. });
  101. </script>
  102. </block>