一旦验证完成并提交表单,我想停止禁用提交按钮,这样我就不会向数据库插入多个。我没有用完整的表单验证更新帖子,因为你们中的大多数人都说这是错误的,但我不这么认为。
这是提交:
<input class="button2" style="border-right:none; font-size:13px;" name="List Item" id="submit" type="submit" value="List Item" />
在 jQuery 验证之下:
<script src="http://jquery.bassistance.de/validate/jquery.validate.js"></script>
<script src="http://jquery.bassistance.de/validate/additional-methods.js"></script>
<script>
$( "#UploadForm" ).validate({
errorLabelContainer: "#messageBox",
wrapper: "td",
rules: {
<?php if ($type == 'Aution' || $type == 'Both') { ?>
auction_price: {
required: true,
number: true,
min: 1.00
},
auction_reserve_price: {
number: true,
range: [1.00, 500000.00]
},
<?php } ?>
<?php if ($type == 'BuyItNow' || $type == 'Both') { ?>
auction_bin_price: {
required: true,
number: true,
range: [1.00, 500000.00]
}, <?php } ?>
Country: {
required: true
},
select3: {
required: true
},
select2: {
required: true
},
auction_postage_type: {
required: true
},
auction_postage_type_price: {
number: true,
range: [0.00, 500000.00]
},
auction_int_postage_type_price: {
number: true,
range: [1.00, 500000.00]
},
Europe1: {
number: true,
range: [1.00, 500000.00]
},
Russia1: {
number: true,
range: [1.00, 500000.00]
},
NorthAmerica1: {
number: true,
range: [1.00, 500000.00]
},
Australia1: {
number: true,
range: [1.00, 500000.00]
},
SouthAmerica1: {
number: true,
range: [1.00, 500000.00]
},
Africa1: {
number: true,
range: [1.00, 500000.00]
},
Asia1: {
number: true,
range: [1.00, 500000.00]
},
MiddleEast1: {
number: true,
range: [1.00, 500000.00]
},
<?php if ($type == 'BuyItNow') { ?>
auction_item_quantity: {
required: true,
digits: true,
range: [1, 99]
},
<?php } ?>
auction_description: {
required: true
},
auction_int_postage_type: {
required: true
},
listing_type: {
required: true
}
},
messages: {
auction_price: "Please Enter Auction Start Price - In Decimal Format, minimum value 1.00",
auction_reserve_price: "Please Enter Auction Reserve Price - In Decimal Format 0.00",
auction_bin_price: "Please Enter Buy It Now Price - In Decimal Format, minimum value 1.00",
select3: "Please Select Main Category",
select2: "Please Select Sub Category",
auction_item_quantity: "Please Enter Quentity - min 1 - max 99",
auction_description: "Please Enter Auction Description - Min 10, Max 1000 characters",
listing_type: "Please Select Listing Type",
auction_postage_type: "Please Select Postage Type",
auction_int_postage_type_price: "Please Enter International Postage Cost In Decimal Format, minimum value 1.00",
auction_postage_type_price: "Please Enter Postage Cost In Decimal Format",
auction_int_postage_type: "Please Select",
Country: "Please Select Country",
},
submitHandler:function(form){
$('#submit').attr('disable',true).css('pointer-events','none');
}
});
</script>