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

app.alert help

Enthusiast ,
Aug 01, 2020 Aug 01, 2020

Copy link to clipboard

Copied

I have field1 and field 2, on field 1 I have app.alert to limit me from entering specific value from field 2 even though field 1
doesn't calculate that value when alert pop it
still change value in field2. What I need to do so when I get alert that field2 stay same and doesn't change it's current value?

TOPICS
Acrobat SDK and JavaScript

Views

2.6K

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 , Aug 05, 2020 Aug 05, 2020

Then modify my custom calculation script above for Field2 like this:

 

if (event.value <= 30) {
this.getField("Field1").value = event.value;
}  else {

if (event.value > 30) { event.value = this.getField("Field1").value;
 }
}

 

Don't change anything. Try it out first as instructed.

 

In the solution I am giving to you  the app alert is not executed in Field1. If you have any calutlations or app.alert scripts in Field1 get rid of it. Or we will continue like the chicken or the egg story of what came fi

...

Votes

Translate

Translate
Enthusiast ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

Sorry but it's not working for me as intended. All I need is if I get app.alert from field1 after entering value in field2, field2 need to return to it's previous value before app.alert.

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
LEGEND ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

You are talking as if the app.alert is changing things. Alerts DO NOT CHANGE FIELDS. Your code does. ALERTS CANNOT RUN JAVASCRIPT. You have never posted the code with the app.alert in it, you are still hiding so much from us. This is very frustrating, would you expect to help you fix your car if you won't tell them about the problems !!

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
Enthusiast ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

here is my file PDF try adding values and see what happen when you add above 30.

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 ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

Look at the field names that I used in my examples:

 

this.getField("Field1").value;

 

In your file you're using "field1"   the "f" is in lower case in your PDF. The fieldnames must match exactly how they're spelled or it won't work.

 

Here's your fixed 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
Enthusiast ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

LATEST

Thanks I already modify it, it's working even if app.alert is in field1, thanks again for your help.

 

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 ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

May be better when you use a custom validation script.

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 ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

Then modify my custom calculation script above for Field2 like this:

 

if (event.value <= 30) {
this.getField("Field1").value = event.value;
}  else {

if (event.value > 30) { event.value = this.getField("Field1").value;
 }
}

 

Don't change anything. Try it out first as instructed.

 

In the solution I am giving to you  the app alert is not executed in Field1. If you have any calutlations or app.alert scripts in Field1 get rid of it. Or we will continue like the chicken or the egg story of what came first.

 

Everything will run from Field2 in this example.

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