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

Editable Dynamic Stamp

New Here ,
Sep 24, 2020 Sep 24, 2020

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.

TOPICS
Acrobat SDK and JavaScript

Views

1.8K

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 , Oct 02, 2020 Oct 02, 2020

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);


}

Votes

Translate

Translate
Community Expert ,
Sep 24, 2020 Sep 24, 2020

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);

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
New Here ,
Sep 25, 2020 Sep 25, 2020

Copy link to clipboard

Copied

Try67, Thank you. I'll research "variables". I didn't see any in samples I had looked at.

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
New Here ,
Sep 25, 2020 Sep 25, 2020

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;

}

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 ,
Sep 25, 2020 Sep 25, 2020

Copy link to clipboard

Copied

You have to declare the variables before using them.

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
New Here ,
Sep 25, 2020 Sep 25, 2020

Copy link to clipboard

Copied

Thank you, that doesn't help a novice much though.

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 ,
Sep 25, 2020 Sep 25, 2020

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);

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
New Here ,
Sep 26, 2020 Sep 26, 2020

Copy link to clipboard

Copied

Thank you. I'll look some more, still can't make it work.

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
New Here ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

Still can't make it work.

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 ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

For further help I'll need to see the actual stamp file.

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
New Here ,
Oct 02, 2020 Oct 02, 2020

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.Clough.jpg

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 ,
Oct 02, 2020 Oct 02, 2020

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.

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
New Here ,
Oct 02, 2020 Oct 02, 2020

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.

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 ,
Oct 02, 2020 Oct 02, 2020

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);


}

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
New Here ,
Oct 02, 2020 Oct 02, 2020

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)

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 ,
Oct 02, 2020 Oct 02, 2020

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.

 

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
New Here ,
Oct 05, 2020 Oct 05, 2020

Copy link to clipboard

Copied

LATEST

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!

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