Copy link to clipboard
Copied
Hi All,
If i apply a SSN(social Security number format) using below javascript, it allows alphabets to enter in the field, to correct that i have to manually set the format again in the field properties. I am not sure what makes the field to act like this. Below is the screenshot and JS .
var arr = ['clm_ssn', 'ee_ssn', 'patient_ssn', 'ssnp6',];
for (var i = 0; i < this.numFields; i++) {
var s = this.getField(this.getNthFieldName(i));
if (arr.indexOf(s.name) >= 0) {
s.setAction("Format", "AFSpecial_Format(3)");
s.setAction("Keystroke", "AFSpecial_KeystrokeEx(3)");
}
}
Copy link to clipboard
Copied
The script changes the format of the fields.
Copy link to clipboard
Copied
Yes Bernd Alheit, Thats what i wanted the field format should be in SSN. However it should not allow any alphabets in that field. In this case post changing the format to ssn it still allows to type alphabets.
Copy link to clipboard
Copied
The function AFSpecial_KeystrokeEx requires a mask as parameter.
Replace the 3.
Copy link to clipboard
Copied
Hi Bernd,
I am currently at a beginner level in JavaScript. Could you kindly provide a more detailed explanation regarding masking?
Copy link to clipboard
Copied
In 'AFSpecial_KeystrokeEx' you also need to add mask: '999-99-9999'
Copy link to clipboard
Copied
So after running the code we have to manually set the mask is that correct Nesa.
Copy link to clipboard
Copied
Where did you find that this is the right code for an SSN field?
Copy link to clipboard
Copied
When I run the script in action wizard it changes the format to Social security number, and if i type numbers it shows in the ssn format (XXX-XX-XXXX). however it also allows the field to type alphabets and it changing to 2 hypens (screenshot). also I have attached the screenshot in previous chat with the format.