12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- {include file="public/header" /}
- <div class="page">
- <form id="region_form" method="post">
- <table class="ds-default-table">
- <tbody>
- <tr class="noborder">
- <td class="required w120">{$Think.lang.area_name}</td>
- <td class="vatop rowform"><input type="text" class="input-txt" name="area_name" id="area_name" value="{$area.area_name|default=''}" /></td>
- <td></td>
- </tr>
- <tr class="noborder">
- <td class="required w120">{$Think.lang.area_initial}</td>
- <td class="vatop rowform"><input type="text" class="input-txt" name="area_initial" id="area_initial" value="{$area.area_initial|default=''}" oninput="value=value.replace(/[^A-Z]/g,'');" /></td>
- <td class="vatop tips">{$Think.lang.area_initial_error}</td>
- </tr>
- <tr class="noborder">
- <td class="required w120">{$Think.lang.area_parentid}</td>
- <td class="vatop rowform">
- <select name="area_parentid">
- <option value="0">{$Think.lang.ds_common_pselect}</option>
- {foreach name="parents" item="parent" key="k" }
- <option value="{$k}" {if condition="$k == $area.area_parent_id"}selected{/if}>{$parent|raw}</option>
- {/foreach}
- </select>
- </td>
- </tr>
- <tr class="noborder">
- <td class="required w120">{$Think.lang.area_region}</td>
- <td class="vatop rowform"><input type="text" class="input-txt" name="area_region" id="area_region" value="{$area.area_region|default=''}" /></td>
- <td></td>
- </tr>
- <tr class="noborder">
- <td class="required w120">{$Think.lang.area_sort}</td>
- <td class="vatop rowform"><input type="text" class="input-txt" name="area_sort" id="area_sort" value="{$area.area_sort|default='255'}" /></td>
- <td></td>
- </tr>
- </tbody>
- <tfoot>
- <tr class="tfoot">
- <td></td>
- <td colspan="15"><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
- </tr>
- </tfoot>
- </table>
- </form>
- </div>
- <script>
- jQuery.validator.addMethod("initial", function(value, element) {
- return /^[A-Z]$/i.test(value);
- }, "");
- //按钮先执行验证再提交表单
- $(function () {
- $('#region_form').validate({
- errorPlacement: function (error, element) {
- error.appendTo(element.parent().parent().find('td:last'));
- },
- rules: {
- area_name: {
- required: true
- },
- area_initial: {
- initial : true
- },
- area_region: {
- maxlength: 3
- },
- area_sort: {
- digits: true,
- range: [0, 255]
- }
- },
- messages: {
- area_name: {
- required: '{$Think.lang.area_name_error}'
- },
- area_initial: {
- initial : '{$Think.lang.area_initial_error}'
- },
- area_region: {
- maxlength: '{$Think.lang.area_region_error}'
- },
- area_sort: {
- digits: '{$Think.lang.ds_digits_error}',
- range: '{$Think.lang.area_sort_error}'
- }
- }
- });
- });
- </script>
|