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

Need scripting help

Explorer ,
Oct 13, 2025 Oct 13, 2025

Working with Adobe Acrobat 10 Pro. Trying to add following script at document level not to allow spacebar as first character for any text field in the document,

function spacebar()
{

var v = AFMergeChange(event);
if (/^\s/.test(v)) event.rc = false;

}

The function works pefectly. However, this action changes all date fields format from default "dd-mmm-yyyy"  to "AFDate_FormatEx("dd-mmm-yyyy");" custom format which I don't want. Apparently non-English Adobe Acrobat does not recognizes "AFDate_FormatEx("dd-mmm-yyyy");" format and date fields become invisible, empty, or non-descriptive text.

Joe2787079753nv_0-1760406488496.png

 

How could I prevent the date field format changing from default "dd-mmm-yyyy" to 

"AFDate_FormatEx("dd-mmm-yyyy");"

Thanks in advance for any help

 

201
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 ,
Oct 13, 2025 Oct 13, 2025

You can try a validation script that will remove 'spacebar' at the beginning once the user enters date:

event.value = event.value.replace(/^\s+/, "");

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
Explorer ,
Oct 21, 2025 Oct 21, 2025

Thanks. The document has more than 200 date fields that are automatically filled with PC current date when related "Initials" fields are entered.

 

I will take your suggestion and perhaps add your code to "Initials" fields and see if that will do it.

 

Thanks again fo your helpful reply.

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 ,
Oct 14, 2025 Oct 14, 2025

You can't. If you use your own Keystroke or Format script it will replace the one the application uses when you select the Date option under Format. It will also mean that the calendar widget won't appear when the user uses the 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
Explorer ,
Oct 21, 2025 Oct 21, 2025
LATEST

Thanks so much for your reply.

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