Remove leading zeros when null
Hello. I am using a cutom validation script to enter leading zeros in a text box.
(function() { var max_len = 9; var val = event.value; while (val.length < max_len) {val = "0" + val;} event.value = val; })();
The problem arises when the value is null the field reports "000000000." I would like for it to be blank if null.
Any help would be greatly appreciated!