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

HELP: Fillable Form IF/THEN Javascript

Community Beginner ,
Jun 24, 2020 Jun 24, 2020

Hi, 

I'm making an invoice form with Acrobat, it's my first time to do it.

I have no idea how to achieve what I want.

See the below image, sometimes we only have one product to write on.

I don't want the other lines to show anything.

 

However, I set "TOTAL2" Calculation as QTY2*UNIT2,

though no.2 has no item, TOTAL2 still shows as 0.00.

1.

I want it can show the correct multiplication when I have to enter row 2(shows the value of QTY2*UNIT2); if row 2 is blank, I hope TOTAL2 is blank, too.

 

**Update**

OMG with JR_Boulay help, I tried to combine this and that script(know nothing about the script) and I found a way that works!!! Not sure if it is a correct way, but it meets my demand.

 

 

var t = this.getField("QTY2").value*this.getField("UNIT2").value;
event.value = t;
if (event.value == 0) {event.value = ""};

 

 

This can make the TOTAL2 column remain blank if there's no data of item 2;

also, it'll do the multiplication script when item2 exits.

 

---------------------------------------------------------

 

2. Similar problem with the small square "SYMBOL", at the left side of "UNIT2".

Because we use a different currency, so I should make it changeable.

I copy&paste it, so it will show the same result of the upper currency symbol.

However, if row 2 is blank, it still shows. 

So I delete the copy one, make a new text field, but have no idea how to deal with it.

 

What I need is, the SYMBOL column remain blank if there's no item2;

if I have to enter item2's data, I want the SYMBOL column to show the currency symbol, which there's already a CS column in the form, I entered it manually. I hope the SYMBOL column can sync with the CS column.

 

**Update**

I found a way to solve it:

var t = this.getField("QTY2").value;
var s = this.getField("CS").value;
if (t == 0) event.value = "";
else event.value = s;

not sure if it is correct but the same, it meets my demand.

 

Please show me the exact javascript codes to me, many thanks!!

 

WeChat Screenshot_20200624184526.png

 

[Solved, JR_Boulay 's answer]3. Could anyone tell me, if I finished the form, before I send it to my client, what should I do to prevent others to edit my form while they can sign&stamp on it???

 

I tried to search the method for the above 3 problems online, but after trying those codes, they didn't work. My bad.

 

Thank you!

TOPICS
PDF forms
400
Translate
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 ,
Jun 24, 2020 Jun 24, 2020

1- Place this script as a custom validation script in each calculated field:

if (event.value == 0) {event.value = ""};


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 ,
Jun 24, 2020 Jun 24, 2020

Thank you!

 

But some calculated fields need this script and multiplication script.

Do you have any idea to combine these scripts??

Translate
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 ,
Jun 24, 2020 Jun 24, 2020

3- If you're using Acrobat Pro you should flatten the form before sending it.


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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 ,
Jun 24, 2020 Jun 24, 2020
LATEST

Thanks! I tried and it works.

Translate
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