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

Need a Validation Script that is a IF Custom Script

New Here ,
Jul 25, 2021 Jul 25, 2021

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
605
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
1 ACCEPTED SOLUTION
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 = ""}; 

 

View solution in original post

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
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 = ""}; 

 

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

Thank you so much 🙂

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