Copy link to clipboard
Copied
I'm having trouble with my code (I think). I have a dynamic stamp created and have added 2 text fields. One to enter the document # and one to prompt the user to enter the Revision. The code for the document # was easy thanks to this board.
event.value = event.source.source.documentFileName.split(".").shift();
However, I cannot figure our the code to promt the user to enter the revision. The code i have is:
if ((event.source.forReal)&&(event.source.stampname == "#GHhz9-BkcmvhZfa7GtQxrA"))
{
event.value("Revision").value = app.response(cAsk, cRevision);
}
But it does nothing. Any help for a novice would be awesome.
You have multiple errors in your code. The main one being that the stampName (not stampname...) is not the same as the file name. Use this code:
if ((event.source.forReal)&&(event.source.stampName == "#_OMXiRb9vvDgKPJ3Ce0dsB"))
{
var cAsk = "Enter Revision";
var cRevision = "A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R";
event.value = app.response(cAsk, cRevision);
}
Copy link to clipboard
Copied
Is that the full code? Where's the definition of the cAsk and cRevision variables?
Also, change this:
event.value("Revision").value = app.response(cAsk, cRevision);
To:
event.value = app.response(cAsk, cRevision);
Copy link to clipboard
Copied
Try67, Thank you. I'll research "variables". I didn't see any in samples I had looked at.
Copy link to clipboard
Copied
I've added variables but still not working. cade so far:
if ((event.source.forReal)&&(event.source.stampname == "#GHhz9-BkcmvhZfa7GtQxrA"))
{
event.value = app.response(cAsk, cRevision);
event.value = cMsg;
var cAsk = "Enter Revision";
var cRevision = "A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R";
event.source.source.info.Revision = cMsg;
}
Copy link to clipboard
Copied
You have to declare the variables before using them.
Copy link to clipboard
Copied
Thank you, that doesn't help a novice much though.
Copy link to clipboard
Copied
Like this:
var cAsk = "Enter Revision";
var cRevision = "A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R";
event.value = app.response(cAsk, cRevision);
Copy link to clipboard
Copied
Thank you. I'll look some more, still can't make it work.
Copy link to clipboard
Copied
Still can't make it work.
Copy link to clipboard
Copied
For further help I'll need to see the actual stamp file.
Copy link to clipboard
Copied
Try67, I'll attach an image of the stamp as I don't see a way to attach my stamp file.pdf. Thank you for your help.
Copy link to clipboard
Copied
That's not really helpful. You can attach the stamp file like any other file.
You can attach it to the original message using the tiny paperclip icon at the bottom when you edit it, or upload it to a file-sharing website (like Dropbox, Google Drive, Adobe Cloud, etc.), generate a share link and then post it here.
Copy link to clipboard
Copied
No paperclip to attach file. Only an image or a video.
I created a download link:
https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:73badc84-0c78-46a0-bb58-21c480062a0b
It's the last stamp in the pdf file.
Copy link to clipboard
Copied
You have multiple errors in your code. The main one being that the stampName (not stampname...) is not the same as the file name. Use this code:
if ((event.source.forReal)&&(event.source.stampName == "#_OMXiRb9vvDgKPJ3Ce0dsB"))
{
var cAsk = "Enter Revision";
var cRevision = "A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R";
event.value = app.response(cAsk, cRevision);
}
Copy link to clipboard
Copied
Try67, Thank you! It is working now. I don't understand the stamp name then. The file with all the stamps is called what I had, (GHhz9-BkcmvhZfa7GtQxrA.pdf)
Copy link to clipboard
Copied
But as I said, that has nothing to do with the stampName property. To find that out you can apply a stamp and then select it with the mouse and run this code from the JS Console:
this.selectedAnnots[0].AP
Or you can add the following code to a field in the stamp itself:
if (event.source.forReal) app.response("Stamp name:", "", event.source.stampName);
Then copy it from that window into your code.
Copy link to clipboard
Copied
Try67, Having the correct code you provided has been a great in helping me understand what I have been reading about JS and I feel I will be able to do a lot more with it now. Thank you!