I have the following form:
<form id="fromWiw" action="..." method="post">
...
<div class="controls span5 pull-left">
<label class="control-label" for="Quantity">@Resources.Quantity</label>
<input class="span12" id="Quantity" name="Quantity" type="number" min="0" value="0" required />
</div>
<div class="controls span5 pull-left">
<label class="control-label" for="Price">@Resources.Price</label>
<input class="span12" id="Price" name="Price" required />
</div>
...
</form>
For the validation part, I have this code snippet:
form.submit(function() {
form.validate(
{
rules: {
Quantity: { required: true, number: true},
Price: { required: true, number: true }
}
});
});
PROBLEM The validation is working fine, it is detecting when the price and quantity are empty. However, the validation successfully passes when the price input contains non numeric values, text for example. The validation works fine for the Quantity input. Am I doing something wrong here?