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.


Need a Validation Script that is a IF Custom Script

New Here ,
Jul 25, 2021 Jul 25, 2021

Copy link to clipboard

Copied

Hi, 

 

I am editing a form i created and trying to save myself having to manually enter as much as possible.

I have a field, lets call it 'A' this field shows the total price. I need it so that if field 'B' is set to 'Yes', then field 'A' will minus the number in field 'C'.

 

Context is, Total price (A) - VAT (C) if they are exempt (B = Yes)

any help would really be appreciated, i've tried all sorts. 

TOPICS
JavaScript, PDF forms

Views

40

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

Engaged , Jul 25, 2021 Jul 25, 2021
Put this script in custom calculation script of Field D or wherever you want the difference to be:var a = this.getField("FieldA"); var b = this.getField("FieldB"); var c = this.getField("FieldC");if(b.value == "Yes"){event.value = a.value - c.value}  else if(b.value != "Yes") {event.value = ""}; 

Likes

Translate

Translate
Engaged ,
Jul 25, 2021 Jul 25, 2021

Copy link to clipboard

Copied

Put this script in custom calculation script of Field D or wherever you want the difference to be:

var a = this.getField("FieldA");
var b = this.getField("FieldB");
var c = this.getField("FieldC");

if(b.value == "Yes"){event.value = a.value - c.value} 
else if(b.value != "Yes") {event.value = ""}; 

 

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
New Here ,
Jul 25, 2021 Jul 25, 2021

Copy link to clipboard

Copied

LATEST

Thank you so much 🙂

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