Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Creating an App.Alert Based on Two Different Criteria

Community Beginner ,
Sep 08, 2021 Sep 08, 2021

Copy link to clipboard

Copied

Hello,

 

I need a calculated field total be less than 80 AND value in another field. It works perfectly when I make the value rise above 80, but I can't get it to also take into account the other field, which happens to be 60 at the moment. Below is the code I have currently:

 

var v1 = getField("Module Adjusted VOC").value;

 

if(event.value < 0 || event.value > 80)

{

app.alert("Module Adjusted VOC must be less than the Microinverter Max DC Input Voltage with 80V AFCI Cap. Otherwise, this Standard Plan cannot be used.",0);

event.target.textColor = color.red;

}

else

{

event.target.textColor = color.black;

}

if(event.value > getField("Inverter Max DC Input Voltage"),value) { app.alert("Module Adjusted VOC must be less than the Microinverter Max DC Input Voltage with 80V AFCI Cap. Otherwise, this Standard Plan cannot be used.",0);

}

else

{

event.target.textColor = color.black;

}

TOPICS
Create PDFs, General troubleshooting, JavaScript, PDF forms

Views

20

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 , Sep 08, 2021 Sep 08, 2021
Just add it as another OR condition to the first if-statement: if(event.value < 0 || event.value > 80 || event.value > Number(this.getField("Inverter Max DC Input Voltage").valueAsString)) { app.alert("Module Adjusted VOC must be less than the Microinverter Max DC Input Voltage with 80V AFCI Cap. Otherwise, this Standard Plan cannot be used.",0); event.target.textColor = color.red; } else { event.target.textColor = color.black; }

Likes

Translate

Translate
Adobe Community Professional ,
Sep 08, 2021 Sep 08, 2021

Copy link to clipboard

Copied

Just add it as another OR condition to the first if-statement:

 

if(event.value < 0 || event.value > 80 || event.value > Number(this.getField("Inverter Max DC Input Voltage").valueAsString)) {
	app.alert("Module Adjusted VOC must be less than the Microinverter Max DC Input Voltage with 80V AFCI Cap. Otherwise, this Standard Plan cannot be used.",0);
	event.target.textColor = color.red;
} else {
	event.target.textColor = color.black;
}

 

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
Community Beginner ,
Sep 08, 2021 Sep 08, 2021

Copy link to clipboard

Copied

LATEST

Works perfectly, 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