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

Need Some help with javascript

Explorer ,
Nov 12, 2024 Nov 12, 2024

Copy link to clipboard

Copied

tooR_1-1731445133234.png

Dear All,

I have two preoccupations

  1.  i need some help with the script on adode.

my problem is as follows.

several parts are delivered to different customers in different years and city.
I would like dropdown 4 to display only the serial numbers of the items delivered that year, depending on the year, customer and town selected.
-- some information is pre-recorded for example (as in the photo)

 

By default, only drop-down 1 is displayed.
when I select a year, drop-down 2 is displayed,
when I select a customer, drop-down 3 is displayed,
and when I choose city, I can't display the serial numbers.

 

 

  1. is it possible to create a table like the one below in abode, so that + allows me to add rows and - to reduce them?

tooR_2-1731445842843.png

 

 

thanks in advance

 

 

TOPICS
Create PDFs , JavaScript , Modern Acrobat , PDF , PDF forms

Views

182

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Nov 13, 2024 Nov 13, 2024

The XFA form may look like a PDF, but it is not. It's a completely different type of form technology based on XML.  Adobe has taken this technology and put a PDF shell around it.  But the PDF part is just a shell. The form itself has nothing whatsoever to do with PDF. 

 

XFA was repackaged years ago as ADM.  If you want to create such a form, then get the ADM designer. However, the form will only work in the desktop Acrobat and Reader. It will not operate in any other PDF viewer, cause you know,

...

Votes

Translate

Translate
Community Expert ,
Nov 12, 2024 Nov 12, 2024

Copy link to clipboard

Copied

The page content in a PDF is fixed. It is not dynamic, so there is no way to add new rows to a table. 

 

For the dropdowns, it sounds like you want the entries in one dropdown to be set by a selection in another drop down. 

Yes, this is possible. The first article linked below covers this topic. However, if populating the entries depends on several other other dropdowns, then the script must be a calculation script on a hidden field. 

 

Here are some helpful articles on programming lists.

https://acrobatusers.com/tutorials/js_list_combo_livecycle/

https://acrobatusers.com/tutorials/change_another_field/

https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm

 

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

Votes

Translate

Translate

Report

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 ,
Nov 13, 2024 Nov 13, 2024

Copy link to clipboard

Copied

@Thom Parker  thank you for taking the time to reply. 

I've looked at the links you've sent me and I think they'll help me to tackle my problem more effectively.

 

** concerning the ListProgramming_Part1_XFAForm.pdf document, this is actually what I wanted to do on another document.
I suppose it's impossible to do this with Adobe? 

 

** without first having to ask for your authorisation, I took the liberty of using one of your codes in the

to the ListPrograming_Part1_AcroForm, i have on question, for ex :

 

 

Chasis: [ ["-","None"], ["Rear Bracket",205.95]],
i can do 
2022: [ ["-","None"], ["HRS",SN]],
Sn is the serial number
in the year 2022, for example, Test may have several serial numbers. How do you fill this in?

 

 

I was able to modify the first two dropdowns, but for the rest, I'm really lost, can you please help me?

tooR_0-1731532283529.png

 

 

Votes

Translate

Translate

Report

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 ,
Nov 13, 2024 Nov 13, 2024

Copy link to clipboard

Copied

LATEST

The XFA form may look like a PDF, but it is not. It's a completely different type of form technology based on XML.  Adobe has taken this technology and put a PDF shell around it.  But the PDF part is just a shell. The form itself has nothing whatsoever to do with PDF. 

 

XFA was repackaged years ago as ADM.  If you want to create such a form, then get the ADM designer. However, the form will only work in the desktop Acrobat and Reader. It will not operate in any other PDF viewer, cause you know, it's not a PDF. 

 

Please use all the code from the examples as you wish. 

 

So now,  the problem you've described is only slightly more complex than the one in the article.  Everything you want to do is doable, but requires the proper data organization and code.   For example, if there are several SNs for each thing, then replace SN with an array of SNs

 

2022: [ ["-","None"], ["TEST",[SN1,SN2,SN3]]],

 

That said, maybe a different approach would be better for you. Do you currently have a spreadsheet of all the delivered parts that includes the citys, years, etc? If that is the case then may be a better approach is to keep this flat structure and use a search to filter out the parts needed for each stage of the selections. 

 

You'd need some code to automatically load the flat data into the PDF.  Then custom code for searching the data for the data to display for a selection. 

 

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

Votes

Translate

Translate

Report

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