Highlighted

Custom script to show a field if values are equal to or greater than 1

New Here ,
Jul 16, 2020

Copy link to clipboard

Copied

I'm new to editable PDF's and a novice at Javascript. I have three number fields (Text11, Text19, Text27) that if the value inside any one of them is one or higher - I need it to unlock another box below (OTHER1). Does anyone know how I programme this with custom script? 

 

Screenshot 2020-07-16 at 12.06.07.png

Thanks!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

You can do it using this code as the custom calculation script of the text field:

 

var v1 = Number(this.getField("Text11").valueAsString);
var v2 = Number(this.getField("Text19").valueAsString);
var v3 = Number(this.getField("Text27").valueAsString);
event.target.readonly = (v1>=1 || v2>=1 || v3>=1);

Topics

Acrobat SDK and JavaScript, How to

Views

32

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

Custom script to show a field if values are equal to or greater than 1

New Here ,
Jul 16, 2020

Copy link to clipboard

Copied

I'm new to editable PDF's and a novice at Javascript. I have three number fields (Text11, Text19, Text27) that if the value inside any one of them is one or higher - I need it to unlock another box below (OTHER1). Does anyone know how I programme this with custom script? 

 

Screenshot 2020-07-16 at 12.06.07.png

Thanks!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

You can do it using this code as the custom calculation script of the text field:

 

var v1 = Number(this.getField("Text11").valueAsString);
var v2 = Number(this.getField("Text19").valueAsString);
var v3 = Number(this.getField("Text27").valueAsString);
event.target.readonly = (v1>=1 || v2>=1 || v3>=1);

Topics

Acrobat SDK and JavaScript, How to

Views

33

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
Most Valuable Participant ,
Jul 16, 2020

Copy link to clipboard

Copied

You can do it using this code as the custom calculation script of the text field:

 

var v1 = Number(this.getField("Text11").valueAsString);
var v2 = Number(this.getField("Text19").valueAsString);
var v3 = Number(this.getField("Text27").valueAsString);
event.target.readonly = (v1>=1 || v2>=1 || v3>=1);

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
Reply
Loading...
New Here ,
Jul 16, 2020

Copy link to clipboard

Copied

Thank you! That has worked!

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
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF