FireGeek21
Technical User
I have an input box I would like to format. If the user enters as all numbers it shoud format as xxx-xx-xxxx. If a user enters as xxx-xx-xxxx then the formating should remain. I have the following code:
Code for the input box:
Code for the fixSSN function:
This used to work but now returns, "Error: Object doesn't support property or method 'fixSSN'"
Any help would be greatly appreciated! Thanks!
FireGeek
(currently using Crystal Reports XI with Lawson 9.01)
Code for the input box:
JavaScript:
+ '<td class="plaintablecell" nowrap><span id="ficaspan"><input class="inputbox" type="text" name="ficanbr" size="11" maxlength="11" onChange="javascript:this.value=parent.fixSSN(this.value)" onfocus="this.select()"'
Code for the fixSSN function:
JavaScript:
function fixSSN(str)
{
var str = new String(str);
str = str.replace(/[A-Za-z$-()\.]/g, '');
str = str.replace(/[^0-9]/g, '');
str = str.replace( /[^\d]/g, '' );
str = str.replace(/(\d{3})(\d{2})(\d{4})/, '$1-$2-$3');
//alert(str);
return str;
}
This used to work but now returns, "Error: Object doesn't support property or method 'fixSSN'"
Any help would be greatly appreciated! Thanks!
FireGeek
(currently using Crystal Reports XI with Lawson 9.01)