add.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {include file="public/header" /}
  2. <div class="page">
  3. <div class="fixed-empty"></div>
  4. <form id="goods_class_form" method="post">
  5. <table class="ds-default-table">
  6. <tbody>
  7. <tr class="noborder">
  8. <td colspan="2" class="required"><label class="validation" for="fleaclass_name">{$Think.lang.goods_class_index_name}:</label></td>
  9. </tr>
  10. <tr class="noborder">
  11. <td class="vatop rowform"><input type="text" value="" name="fleaclass_name" id="fleaclass_name" class="txt"></td>
  12. <td class="vatop tips"></td>
  13. </tr>
  14. <tr>
  15. <td colspan="2" class="required"><label for="parent_id">{$Think.lang.goods_class_add_sup_class}:</label></td>
  16. </tr>
  17. <tr class="noborder">
  18. <td class="vatop rowform"><select name="fleaclass_parent_id" id="fleaclass_parent_id">
  19. <option value="0">{$Think.lang.ds_please_choose}...</option>
  20. {notempty name="parent_list"}
  21. {foreach name="parent_list" item="v"}
  22. <option {if $fleaclass_parent_id==$v.fleaclass_id}selected='selected'{/if} value="{$v.fleaclass_id}">{$v.fleaclass_name|raw}</option>
  23. {/foreach}
  24. {/notempty}
  25. </select></td>
  26. <td class="vatop tips">{$Think.lang.goods_class_add_sup_class_notice}</td>
  27. </tr>
  28. <tr>
  29. <td colspan="2" class="required"><label>{$Think.lang.ds_display}:</label></td>
  30. </tr>
  31. <tr class="noborder">
  32. <td class="vatop rowform onoff"><label for="fleaclass_show1" class="cb-enable selected"><span>{$Think.lang.ds_yes}</span></label>
  33. <label for="fleaclass_show0" class="cb-disable"><span>{$Think.lang.ds_no}</span></label>
  34. <input id="fleaclass_show1" name="fleaclass_show" checked="checked" value="1" type="radio">
  35. <input id="fleaclass_show0" name="fleaclass_show" value="0" type="radio"></td>
  36. <td class="vatop tips">{$Think.lang.goods_class_add_display_tip}</td>
  37. </tr>
  38. <tr>
  39. <td colspan="2" class="required"><label>{$Think.lang.goods_class_index_display_in_homepage}:</label></td>
  40. </tr>
  41. <tr class="noborder">
  42. <td class="vatop rowform onoff"><label for="fleaclass_index_show1" class="cb-enable selected"><span>{$Think.lang.ds_yes}</span></label>
  43. <label for="fleaclass_index_show0" class="cb-disable"><span>{$Think.lang.ds_no}</span></label>
  44. <input id="fleaclass_index_show1" name="fleaclass_index_show" checked="checked" value="1" type="radio">
  45. <input id="fleaclass_index_show0" name="fleaclass_index_show" value="0" type="radio"></td>
  46. <td class="vatop tips">{$Think.lang.goods_class_add_display_tip}</td>
  47. </tr>
  48. <tr>
  49. <td colspan="2" class="required"><label>{$Think.lang.ds_sort}:</label></td>
  50. </tr>
  51. <tr class="noborder">
  52. <td class="vatop rowform"><input type="text" value="255" name="fleaclass_sort" id="fleaclass_sort" class="txt"></td>
  53. <td class="vatop tips">{$Think.lang.goods_class_add_update_sort}</td>
  54. </tr>
  55. </tbody>
  56. <tfoot>
  57. <tr>
  58. <td colspan="2"><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
  59. </tr>
  60. </tfoot>
  61. </table>
  62. </form>
  63. </div>
  64. <script>
  65. //按钮先执行验证再提交表单
  66. $(function(){
  67. $('#t_id').change(function(){
  68. if($(this).val() == '0'){
  69. $('#t_name').val('');
  70. }else{
  71. $('#t_name').val($(this).find('option:selected').text());
  72. }
  73. });
  74. $('#goods_class_form').validate({
  75. errorPlacement: function(error, element){
  76. error.appendTo(element.parent().parent().prev().find('td:first'));
  77. },
  78. rules : {
  79. fleaclass_name : {
  80. required : true,
  81. remote : {
  82. url :"{:url('Fleaclass/ajax',['branch'=>'check_class_name'])}",
  83. type:'get',
  84. data:{
  85. fleaclass_name : function(){
  86. return $('#fleaclass_name').val();
  87. },
  88. fleaclass_parent_id : function() {
  89. return $('#fleaclass_parent_id').val();
  90. },
  91. fleaclass_id : ''
  92. }
  93. }
  94. },
  95. fleaclass_sort : {
  96. number : true,
  97. range:[0,255]
  98. }
  99. },
  100. messages : {
  101. fleaclass_name : {
  102. required : '{$Think.lang.goods_class_add_name_null}',
  103. remote : '{$Think.lang.goods_class_add_name_exists}'
  104. },
  105. fleaclass_sort : {
  106. number : '{$Think.lang.goods_class_add_sort_int}',
  107. range: '{$Think.lang.ds_range_0_255}'
  108. }
  109. }
  110. });
  111. });
  112. </script>
  113. {include file="public/footer" /}