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

Permanently add a form field to the custom category

New Here ,
Mar 18, 2025 Mar 18, 2025

So given the fact that I am in Canada, I would like to be able to add a permanent form field under the custom category - kinda like how the zip code one is already there. I already found a script for the postal code validation as seen here: 

event.value = event.value.toUpperCase();

if(event.value != "")

{

// validate Canadian postal code;

event.rc = /^(?!.*[DFIOQU])[A-VXY][0-9][A-Z] [0-9][A-Z][0-9]$/.test(event.value);

if(event.rc == false)

{

  app.alert("Please enter a correct Canadian Postal code", 1, 0);

  this.resetForm([event.target.name]);

}

}

(I found this on another post, created by a helpful member of the community)

Aldebrand_0-1742321726492.png

With the display of the tooltip here, it sounds like you should be able to add your own custom scripts to this list, but I have no idea how to do it. Any help would be very appreciated! There's quite a few custom scripts that I would finally be able to add to this list. 

 

TOPICS
How to , JavaScript , PDF forms
103
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 ,
Mar 18, 2025 Mar 18, 2025

You would expect that there would be a preference or configuration file somewhere for adding items to this list of "Special" formatting options (similar to the preference file for the predefined redaction patterns), but there is not. At least not an obvious one.  I did a search on the registry for some of the names that appear in the list and found nothing.   So there doesn't appear to be a preference file or a registry item associated with these options.  Doesn't mean there isn't one, just that I don't know about it. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Mar 18, 2025 Mar 18, 2025

I don't think that's possible, but would be happy to learn if it was!

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 ,
Mar 18, 2025 Mar 18, 2025

I think that tooltip just means what is already in the list.  Here's how to use the arbitrary mask:

https://community.adobe.com/t5/acrobat-discussions/arbitrary-mask-question/m-p/14958392

Canadian postal code would be A9A9A9 but then you would need to leave the first line of your validation script: event.value=event.value.toUpperCase();

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 ,
Mar 18, 2025 Mar 18, 2025
LATEST

You could always create your own list triggered by a custom toolbar button that opens a dialog with a list of field names in the document, and dropdown of script names, that modifies the field based on your selection using the setAction method.

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