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

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

321

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

 

Votes

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

 

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

Copy link to clipboard

Copied

LATEST

Thank you so much 🙂

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