Button + text field script

Explorer ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

Hi, can someone pls make me script that I need or atleast give me some advice how to achive  what I need cuz i'm new to this thx in advance.I explained everything in pdf file.

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

80

Likes

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

Adobe Community Professional , Jul 13, 2020 Jul 13, 2020
- Step 1: Create a (hidden, if you wish) text field called "Counter". - Step 2: Apply the following code as the MouseUp event of the button field: var counter = Number(this.getField("Counter").valueAsString); if (counter<7) this.getField("Counter").value = counter+1; - Step 3: Apply the following code as the custom Calculation script of "Text2": event.value = Number(this.getField("Counter").valueAsString) + "/7 points used"; - Step 4: Apply the following code as the custom Calculation script...

Likes

Translate

Translate
Adobe Community Professional ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

You've asked this multiple times, but your descriptions are not clear.

- What should happen when it reaches "7/7"?

- You say that text3 should add different values as the button is clicked, but add them to what, exactly? Or do you just mean that it needs to be 20, 40, 60, etc.?

 

Also, have you tried writing this code yourself?

Likes

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 ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

When it reaches 7/7 thats it. When text2 show 1/7 text 3 need to show 20(it would be better if it actualy calculated not just show text) I tried to figure out code but i'm new and I think the code I need is far beyond my level. 

Likes

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
Adobe Community Professional ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

- Step 1: Create a (hidden, if you wish) text field called "Counter".

- Step 2: Apply the following code as the MouseUp event of the button field:

var counter = Number(this.getField("Counter").valueAsString);
if (counter<7) this.getField("Counter").value = counter+1;

 

- Step 3: Apply the following code as the custom Calculation script of "Text2":

event.value = Number(this.getField("Counter").valueAsString) + "/7 points used";

 

- Step 4: Apply the following code as the custom Calculation script of "Text3":

event.value = Number(this.getField("Counter").valueAsString)*20;

 

That's all there is to it.

Likes

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 ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

LATEST

You make it look so easy,I would never figure that out on my own.THANK YOU.

Likes

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