Skip to main content
February 7, 2020
Answered

Need help with my script for a condition when 2 fields match

  • February 7, 2020
  • 1 reply
  • 1123 views

Hi all,

I am designing a form in Adobe Pro DC in which I have 4 text fields (Numfield1, Numfield2, Namefield1 and Namefield2) if these fields match or if the difference is 0 (Numfield1 minus Numfield2), I want Namefield2 to autofill the value of Namefield1.

I have been trying with the below code, please note i'm not a programmer and my skillset is limited to finding scripts and customising it for my purpose, hence this script might be way off the mark.

 

var A = this.getField("Numfield1").value; // the value of field A;

var B = this.getField("Numfield2").value; // the value of field B;

var C = A - B; // the value of field A minus the value of field B;

if (C = 0) {

event.value = this.getField("Namefield1").value;

}

This topic has been closed for replies.
Correct answer Bernd Alheit

Use:

if (C == 0) {

1 reply

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
February 7, 2020

Use:

if (C == 0) {

February 7, 2020

Thank a million, it works just as i wanted