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

How can I edit the Format Category of a Text Field Property using Javascript

Guest
Oct 09, 2019 Oct 09, 2019

Howdy,

 

I did my best to locate how to edit a text field property via javascript in this guide:

https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_developer_guide.pdf

 

My situation: 

Currently, I am using javascript to copy each field in a pdf, copy all of its attributes under a new name, and replace the old field. (Thanks to the way copying a field works. IE it keeps the same name and entering information into the original field duplicates that data into the copied fields as well. Cannot manually change the names of 500+ fields daily..) I got the script to run great with one problem. Text Fields can have a format category of "Date," and I cannot seem to figure out how to set this attribute when I create the object via javascript (the fields dont have the calendar option to the right of them, they are just regular text boxes).

 

Example of what I am looking for:

var f = this.addField("coolname", "text", 0, [200, 250, 250, 400]);

f.format = "date";

 

Hope this was clear, thanks for the help!

 

 

2.5K
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 09, 2019 Oct 09, 2019

Hi,

 

Please view this thread and use the guide provided in the suggestions:

 

https://community.adobe.com/t5/Acrobat/Help-Me-Copy-and-paste-a-date-for-another-date-field-Acrobat-...

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
Guest
Oct 10, 2019 Oct 10, 2019
So I am not trying to actually input a date, nor am I trying to copy a date from another date field. I am attempting to create a field that is set with the date format. So later another user can input a date into that field via the calendar.
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 10, 2019 Oct 10, 2019

Ooooh! ok that is too easy. just select date field add it to your document like you would for a text field. You can also add a text field and in the field Properties go to the Format tab and select from the pulldown DATE. You can choose any of the pre-selected date formats that are listed there or provide a custom date format. So when your user inputs a date, like for example, let's say he/she types in "9sep" and hit enter it will adjust automatically and complete the date using the format that you specified for that field; the same will happen if the user choose a date from the date picker... I think this is what is referred to arbitrary masking (someone please correct me if I am wrong)

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
Guest
Oct 10, 2019 Oct 10, 2019
Thanks again for your help, but unfortunately I am trying to do it via javascript. Not using the actual properties popup. I am running javascript in the adobe debugger (ctrl-j).
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 10, 2019 Oct 10, 2019
LATEST
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