form.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. {include file="public/header" /}
  2. <div class="page">
  3. <form id="express_form" method="post" name="form1" enctype="multipart/form-data">
  4. <table class="ds-default-table">
  5. <tbody>
  6. <tr class="noborder">
  7. <td class="required w120"><label class="validation">{$Think.lang.express_name}:</label></td>
  8. <td class="vatop rowform"><input type="text" value="{$express.express_name|default=''}" name="express_name" id="express_name" class="txt"></td>
  9. <td class="vatop tips"></td>
  10. </tr>
  11. <tr class="noborder">
  12. <td class="required w120"><label class="validation">{$Think.lang.express_code}:</label></td>
  13. <td class="vatop rowform"><input type="text" value="{$express.express_code|default=''}" name="express_code" id="express_code" class="txt"></td>
  14. <td class="vatop tips"></td>
  15. </tr>
  16. <tr class="noborder">
  17. <td class="required w120"><label class="validation">{$Think.lang.express_letter}:</label></td>
  18. <td class="vatop rowform"><input type="text" value="{$express.express_letter|default=''}" name="express_letter" id="express_letter" class="txt"></td>
  19. <td class="vatop tips"></td>
  20. </tr>
  21. <tr class="noborder">
  22. <td class="required w120"><label class="validation">{$Think.lang.express_url}:</label></td>
  23. <td class="vatop rowform"><input type="text" value="{$express.express_url|default=''}" name="express_url" id="express_url" class="txt"></td>
  24. <td class="vatop tips"></td>
  25. </tr>
  26. <tr class="noborder">
  27. <td class="required">{$Think.lang.express_state}: </td>
  28. <td class="vatop rowform onoff">
  29. <label for="express_state1" class="cb-enable {if $express.express_state == '1'}selected{/if}" title="{$Think.lang.ds_yes}"><span>{$Think.lang.ds_yes}</span></label>
  30. <label for="express_state0" class="cb-disable {if $express.express_state == '0'}selected{/if}" title="{$Think.lang.ds_no}"><span>{$Think.lang.ds_no}</span></label>
  31. <input id="express_state1" name="express_state" {if $express.express_state == '1'}checked="checked"{/if} value="1" type="radio">
  32. <input id="express_state0" name="express_state" {if $express.express_state == '0'}checked="checked"{/if} value="0" type="radio">
  33. </td>
  34. <td class="vatop tips"></td>
  35. </tr>
  36. <tr class="noborder">
  37. <td class="required">{$Think.lang.express_order}: </td>
  38. <td class="vatop rowform onoff">
  39. <label for="express_order1" class="cb-enable {if $express.express_order == '1'}selected{/if}" title="{$Think.lang.ds_yes}"><span>{$Think.lang.ds_yes}</span></label>
  40. <label for="express_order0" class="cb-disable {if $express.express_order == '2'}selected{/if}" title="{$Think.lang.ds_no}"><span>{$Think.lang.ds_no}</span></label>
  41. <input id="express_order1" name="express_order" {if $express.express_order == '1'}checked="checked"{/if} value="1" type="radio">
  42. <input id="express_order0" name="express_order" {if $express.express_order == '2'}checked="checked"{/if} value="2" type="radio">
  43. </td>
  44. <td class="vatop tips"></td>
  45. </tr>
  46. </tbody>
  47. <tfoot>
  48. <tr class="tfoot">
  49. <td colspan="15" ><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
  50. </tr>
  51. </tfoot>
  52. </table>
  53. </form>
  54. </div>
  55. <script>
  56. //按钮先执行验证再提交表单
  57. $(function () {
  58. jQuery.validator.addMethod("initial", function(value, element) {
  59. return /^[A-Za-z0-9]$/i.test(value);
  60. }, "");
  61. $("#express_form").validate({
  62. errorPlacement: function (error, element) {
  63. error.appendTo(element.parent().parent().find('td:last'));
  64. },
  65. rules: {
  66. express_name: {
  67. required: true,
  68. },
  69. express_code: {
  70. required: true
  71. },
  72. express_letter: {
  73. initial: true
  74. },
  75. express_url: {
  76. required: true
  77. },
  78. },
  79. messages: {
  80. express_name: {
  81. required: '{$Think.lang.express_name_null}',
  82. },
  83. express_code: {
  84. required: '{$Think.lang.express_code_null}'
  85. },
  86. express_letter: {
  87. initial: '{$Think.lang.express_letter_null}',
  88. },
  89. express_url: {
  90. required: '{$Think.lang.express_url_null}'
  91. },
  92. }
  93. });
  94. });
  95. </script>