Click to See Complete Forum and Search --> : Dfilter - Social Security Number


JulieDancer
08-12-2003, 07:01 AM
Hi,

Does anyone know why the keypad does not work with "dfilter"?

When I use it to format a SSN textbox, it kinda works with the regular number keys but returns LETTERS when I try to use the number keypad.

Is there another script out there that will format a SSN field as well or better?

Thanks!

Charles
08-12-2003, 07:35 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>
<form action="">
<script type="text/javascript">
<!--
function SSNumber (s) {this.number = s.match(/\d/g); if (!this.number || this.number.length != 9) this.number = null}

SSNumber.prototype.toString = function () {return this.number == null ? NaN : [this.number[0], this.number[1], this.number[2], '-', this.number[3], this.number[4], '-', this.number[5], this.number[6], this.number[7], this.number[8]].join('')}
// -->
</script>
<div>
<input type="text" onchange="this.value = new SSNumber(this.value); if (this.value == 'NaN') {alert('That does not appear to be a valid SSN.'); this.value = ''; this.focus}">
<input type="submit">
</div>
</form>