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

# amp formulaire pdf conditionnel

New Here ,
Aug 04, 2024 Aug 04, 2024

Copied

Bonjour,

je n'arrive pas à écrire le bon scripte pour un calcul conditionnel dans le formulaire pdf acrobat:

Champ 1 (B2) = liste avec choix =1 ou choix =2

Champ 2 (C2) = chiffre à remplir par la personne

Champ 3 = résultat calculé

Dans excel cela donne:
=SI(B2=1;C2;SI(B2=2;C2*1,5))
Merci!

TOPICS
PDF forms

Views

76

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
3 Replies 3
Community Expert ,
Aug 04, 2024 Aug 04, 2024

Copied

Try this code as the custom calculation script:

``````var B2 = this.getField("B2").valueAsString;
var C2 = Number(this.getField("C2").valueAsString);
if (B2=="1") event.value = 1;
else if (B2=="2") event.value = C2*1.5;
else event.value = "";``````

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Aug 05, 2024 Aug 05, 2024

Copied

Hello and thank you, it's perfect like this and I understand 😉
There is just on the 3rd line, the modification *1

if (B2=="1") event.value = C2*1;

A beautiful day

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 Expert ,
Aug 05, 2024 Aug 05, 2024

Copied

LATEST

Ah sorry, I misread the syntax of the Excel formula.

Use this:

``````else if (B2=="2") event.value = C2;
else event.value = 5;``````

There's no need to multiply by one.