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

Hello. i have varv1 and varv2.

Explorer ,
Feb 02, 2018 Feb 02, 2018

Copy link to clipboard

Copied

Hello. i have varv1 and varv2. and i want varv2<=varv1 if not it wrong

I START LIKE THIS

// Get field values as numbers

    var v1 = +getField("Textfield66").value;

    var v2 = +getField("Textfield67").value;

how can i end it?

Thanks

TOPICS
Acrobat SDK and JavaScript

Views

709

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 , Feb 02, 2018 Feb 02, 2018

Add this at the end of your code:

if (v2<=v1) app.alert("Error! v2<=v1");

Votes

Translate

Translate
Explorer ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

Hello i have this script but it is not working

Format persentage

validation script

// Get field values as numbers

    v1 = +getField("Textfield28").value;

v2 = +getField("Textfield34").value;v3 = +getField("Textfield40").value;v4 = +getField("Textfield46").value;v5 = +getField("Textfield52").value;

v6 = +event.value;

if (v6>v1+v2+v3+v4+v5){ app.alert("ΛΑΘΟΣ! 612 μεγαλύτερο του 611 οι Εισαγωγές αγαθών εντός του ομίλου πρέπει να είναι μικρότερες η ίσες με τις Συνολικές Εισαγωγές αγαθών");

event.rc = false;

}

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 ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

Saying "it's not working" is not very helpful... What exactly goes wrong?

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
Explorer ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

LATEST

ok first  ι used to validate the above  script.Then to format persentage and finally to calculate i used value is the sum(+) of the following fields (Textfield28+.........)

What exactly i need is that the sum(+) of var1,var2,var3,var4,var5 must not be more than 100%(1) and less than 100%(1).It must be 100%

{ app.alert(" the sum(+) of var1,var2,var3,var4,var5 must not be more than 100%(1) and less than 100%(1).It must be 100%");

event.rc = false;

}

for example if i will write to the first cell 50% and to the second cell 60% this should not let the user go ahead.

Another example is first cell 20%.second 20%,third 20%,fourth 20% and fifth 10%.That is less than 100% and it is wrong.

Thanks

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 ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

Your syntax error is very clear from the message. Programmers often get this kind of error, and the solution is to carefully count brackets.

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