![Picture of Matías montes Picture of Matías montes](/picture/user/234588.jpg)
Matías montes - 2007-03-02 14:32:54
Numbers with leading zeros such as: 011, 0066, etc should be considered valid numeric values but they fail numeric validations (integer, float, etc)
solution:
I replaced line 2240 (the one that creates the Javascript Validation for ValidateAsInteger) for:
$t = $field_value.".match(/^(0+)?(.*)/g) && parseInt(".$field_value.",10).toString()!=(RegExp.$2.length == 0 ? '0' : RegExp.$2)";
Explanation:
The first regular expression will always match, but I need it to save the non-zero values in RegExp.$2
Then, instead of checking the integer value of the field against its current value, I check it against the zero trimmed value.
The conditional verification with the expression length is for the value '0' (or '00' or '000', etc) which should be considered a valid integer.