2
How to make the field mandatory when the value is 0.00 using jquery validate ?
Following example in image:
As you can see in the image above, the person did not enter the value, when clicking the accept button, the jquery validate works normally the following image:
Now the problem is when type value 0,00. Follow the image :
As you can see from the image above, the value cannot be 0.00, it must be at least 0.01.
Follow the code below:
Html:
<form id="myform">
<input type="text" class="form-control" value="@Model.Valor" id="valor" name="valor" placeholder="Digite o seu valor">
</form>
Javascript:
$('#valor').priceFormat({
    prefix: 'R$ ',
    centsSeparator: ',',
    thousandsSeparator: '.'
});
Jquery Validate:
$(document).ready(function () {
        $("#myform").validate({
            ignore: ":hidden",
            rules: {
                valor: { required: true }
            },
            messages: {
                valor: "<span style=\"color: #a94442;\">Campo Valor é obrigatório *</span>"
            },
            highlight: function (element) {
                $(element).closest('.form-group').addClass('has-error');
            },
            unhighlight: function (element) {
                $(element).closest('.form-group').removeClass('has-error');
            },
            submitHandler: function (form) { etc ....}
I use Jquery-Price-Format. When typing 0.00, jquery should show warning. When it is 0.01 take the jquery validate warning. That is, if it equals 0.00, show red warning. Any solution ?



It worked here. It was only remove prefix as Voce said. Tnks
– Matheus Miranda