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

Using JavaScript to make a Dynamic Stamp Editable

New Here ,
Mar 19, 2024 Mar 19, 2024

Hi there, 

 

I'm developing a tool within adobe to help my accounting team with their specific coding process. 

 

So far, I have a dynamic stamp template that will do the following: 
I place the stamp > a dialog box appears > user inputs information into various text fields > assigns entered information to text fields. The stamp reflects what was input the dialog box once I click ok, however, I want to be able to access the previously input information the next time I try to stamp the same stamp (with the same template). 

 

I notice that once I fill the stamp information out, the template stores the values I entered. However, when I try to stamp again, the dialog box reappears completely empty. I would like the dialog box to reappear with the previously entered values already IN the dialog. Is this possible? 

That is - in the same document. Once I've placed the stamp once, I want to be able to reference the information that was previously entered. This is what happens: 

 

The dialog box on the right created the stamp on the left 

Screenshot 2024-03-19 at 5.53.28 PM.pngexpand image

 

When I try to stamp again, this is what I see (matches the information previously entered):

ABOUT TO RESTAMP.pngexpand image

I would love if once I try to stamp again - where the highlighted "###" would reflect "PO#1234" instead (as well as the rest of the fields with previous inputs). 

CLICKING STAMP DOWN.pngexpand image
If anyone has any insights, they would be very much appreciated. I've thought about a separate object (such as an array) outside of the stamp to then populate the fields, but am having a tough time wrapping my head around that currently. 

 

Attached, please find the working code - there are some testing print commands I was trying to utilize in order to help me track where certain variables were. 

 

Thanks so much, 

TOPICS
General troubleshooting , How to , JavaScript , PDF
873
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 19, 2024 Mar 19, 2024

In order to do that you would need to save the input from the user into a global variable, and then modify the dialog's load function to look for that variable, and if it exists populate the values from it into the fields in the dialog.

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
New Here ,
Mar 20, 2024 Mar 20, 2024

Awesome! I'm reading up on global variables and figuring out how they work - if I were to declare global variables outside of my outermost if stamement and then assign those values instead of the oDlg.items (e.g. poMN, ttot - could they be defined as global variables to start and i replace the variables of the same name within the if statement) ? 

 

I've been learning as I go so far - foundation being CS minor (really only remember Java) - any specific links would be apppreciated!

 

Best, 

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 21, 2024 Mar 21, 2024
LATEST

Yes, you should be able to define those variables anywhere in your code.

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