Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
6

Form Field Format question

Participant ,
May 07, 2024 May 07, 2024

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)");
}
}

 

Magendravarad28403894r8lu_0-1715106639708.png

Magendravarad28403894r8lu_1-1715106695896.png

 

 

TOPICS
JavaScript , PDF , PDF forms
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2024 May 07, 2024

The script changes the format of the fields.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 07, 2024 May 07, 2024

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2024 May 08, 2024

The function AFSpecial_KeystrokeEx requires a mask as parameter.

Replace the 3.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 08, 2024 May 08, 2024

Hi Bernd, 

I am currently at a beginner level in JavaScript. Could you kindly provide a more detailed explanation regarding masking?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2024 May 08, 2024

In 'AFSpecial_KeystrokeEx' you also need to add mask: '999-99-9999'

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 08, 2024 May 08, 2024
LATEST

So after running the code we have to manually set the mask  is that correct Nesa. 

Magendravarad28403894r8lu_0-1715197858810.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2024 May 07, 2024

Where did you find that this is the right code for an SSN field?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 07, 2024 May 07, 2024

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.

Magendravarad28403894r8lu_0-1715119507975.png

Magendravarad28403894r8lu_1-1715119584798.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines