Validation plugin: check if a field contains an integer not equal to zero
Hi everyone,
I have already done a number of things with Jörn's validation plugin
and I'm excited about its features. But here is my question: how do I
validate a field so that it fits the two following conditions: it
should be an integer and should not be equal to zero?
So, if a user enters "0", it should be error; if he/she enters "12.5",
it should be error also; but "-3", "125", "40" are OK.
What should I do then?
this code doesn't work:
<code>
umoney: {
required: true,
number: true,
range: function() {
var money=$("#umoney").val();
if ((money!=0) && (money==parseInt(money, 10))) return true; else return false;
}
},
</code>