Skip to main content
Participating Frequently
January 7, 2023
質問

How to get a app.alert popup when 2 conditions are met in the fillable PDF?

  • January 7, 2023
  • 返信数 1.
  • 2435 ビュー

Hello,

New here so I need some help.

 

How do I get a popup whenever the calculated field is less than 4 AND another field called  "super" has a number value greater than zero.

 

This is what I have and the "super" field doesn't seem to have any effect on the popup.

 

var s = this.getField("super").value;

if(event.value<4&&s>0);
app.alert("All 4 requirements must be met in order to qualify for the super rebate amount.")

 

このトピックへの返信は締め切られました。

返信数 1

Thom Parker
Community Expert
Community Expert
January 7, 2023

remove the semicolon at the end of the if condition. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Betty5C77作成者
Participating Frequently
January 7, 2023

Thanks, but the behavior didn't improve after I removed the semicolon. What I want is that there should be no popup unless the "super" field has a value AND the event field is less than 4.

 

What I have now:

var s = this.getField("super").value;

if(event.value<4&&s>0) app.alert("All 4 requirements must be met in order to qualify for the super rebate amount.")

 

Currently, the alert still pops up whenever the event field is less than zero regardless of what the "super" field value is. It's not taking into account the value of the "super" field. 

 

I'm not sure if it matters, but the event field is the sum of 4 checkboxes, each with an export value of 1. And the "super" field is what the user would put in,

 

Thom Parker
Community Expert
Community Expert
January 8, 2023

Thanks so much for the responses. I'm learning so much. Now I understand some of the past behavior. I am interested to know how I can add a condition to check which field triggered the event. Is it by adding the Validation event on both fields? Please advise. Thanks.


The place to look for this information is the Acrobat JavaScript Reference.

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#event-properties

 

See the "event.source" property.

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often