我怀疑是否可以在发送数据以在数据库中插入的onlick函数之前验证表单,因为当我单击数据时,它会在表单未完成时发送。
HTML
=IF(tblPriorityMatrix[@LkUp]<>0,SUMPRODUCT((tblPriorityMatrix[UniqueRank]<tblPriorityMatrix[@UniqueRank])*(tblPriorityMatrix[LkUp]<>0))+1,0)
JS
<td class="text-center"><input type="checkbox" class="checkbox" name="" /></td>
<td><input type="text" class="form-control input" required="required" name="nomoc" id="nomoc"></td>
<td><input type="text" class="form-control input" required="required" name="qtyoc" id="qtyoc"></td>
<td><input type="text" class="form-control input" required="required" name="skuoc" id="skuoc"></td>
<td>
<select class="form-control m-b" id="provoc" required="" value="">
<?php while($dato2 = mysqli_fetch_array($result2)){ ?>
<option value="<?php echo $dato2['ID_prov'];?>"><?php echo $dato2['nom_fantasia'];?></option>
<?php } ?>
</select>
</td>
<td><input type="text" class="form-control input" required="required" name="link" id="link"></td>
<td><input type="text" class="form-control input" required="required" name="vtoc" id="vtoc"></td>
<td><input type="text" class="form-control input" required="required" name="vdoc" id="vdoc"></td>
答案 0 :(得分:0)
请关注if else部分并将jQuery验证添加到该部分。
function addoc{
var name = document.getElementById("nomoc").value;
var qty = document.getElementById("qtyoc").value;
var sku = document.getElementById("skuoc").value;
var prov = document.getElementById("provoc").value;
var link = document.getElementById("link").value;
var vt = document.getElementById("vtoc").value;
var vd = document.getElementById("vdoc").value;
var obs = document.getElementById("obsoc").value;
if(custome_Jquery_validation)
{
//validation error
}
else if(another_custome_Jquery_validation)
{
//validation error
}.....
else{
$.get("funciones.php", {function : 34, name : name, qty : qty, sku : sku, prov : prov, link : link, vt : vt, vd :vd, obs : obs}, function(data){
});
}
};