Monday, August 13, 2012

Taxable Field Validation

HTML -----------

Form Validation Example

Tax Type:

Sale tax amount:

--------------- Jquery ------------------
$.validator.addMethod("taxAmount_validate", function(value, element, param) { var taxtype = $('#taxType').val(); if (taxtype >= 0) { if (taxtype == 0) { if (value <= 0) { return false; } else { return true; } } if (taxtype == 1 || taxtype == 2) { if (value != 0) { return false; } else { return true; } } } }); $("#taxForm").validate({ debug: true, //prevent submission for testing rules: { taxAmount: { taxAmount_validate: true } }, messages: { taxAmount: { taxAmount_validate: "Enter validate tax amount!." }, } });

No comments:

Post a Comment

Javascript find highest and lowest from the given inputs

function highAndLow(numbers){ // numbers = "4 5 29 54 4 0 -214 542 -64 1 -3 6 -6"   let numbersInArr = numbers.split(' '...