Using JavaScript to make a Dynamic Stamp Editable
Copy link to clipboard
Copied
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
When I try to stamp again, this is what I see (matches the information previously entered):
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).
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,
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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,
Copy link to clipboard
Copied
Yes, you should be able to define those variables anywhere in your code.

