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

Conditional Fields based on a Separate Text Field

New Here ,
Oct 14, 2016 Oct 14, 2016

I've searched the forum community and while this question may have been answered previously, I cannot seem to locate quite the same condition.

We have an Order Form that has a Text box ( PROMO_CODE ) where someone can fill in a Specific Word that is supposed to qualify them for a Discount.  I have a separate text box that automatically calculates the Discount regardless of whether the Text is entered called ( Discount_Subtotal ).

( Discount_Subtotal ) is calculating correctly when that specific product is ordered.

What I am trying to do is test for the ( PROMO_CODE ) such that if that specific word is entered, it will pull over the ( Discount_Subtotal ) and be calculated in the Final Total along with Shipping costs if any.

Here is what I have currently for the Javascript:

var nPROMO_CODE = this.getField("PROMO_CODE").value;

if( nPROMO_CODE = "SPECIFIC_WORD") event.value = Discount_Subtotal;

else event.value = 0;

This isn't working however as when I enter the SPECIFIC_WORD, the Discount is not carried over.

Would someone be able to assist with the correct syntax?

Incidentally this is using Adobe Acrobat XI Pro.

Thanks in advance and Kindest Regards,

Don

TOPICS
Acrobat SDK and JavaScript
472
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

correct answers 1 Correct answer

Community Expert , Oct 14, 2016 Oct 14, 2016

Change this line:

if( nPROMO_CODE = "SPECIFIC_WORD") event.value = Discount_Subtotal;

To:

if (nPROMO_CODE == "SPECIFIC_WORD") event.value = this.getField("Discount_Subtotal").value;

Translate
Community Expert ,
Oct 14, 2016 Oct 14, 2016

Change this line:

if( nPROMO_CODE = "SPECIFIC_WORD") event.value = Discount_Subtotal;

To:

if (nPROMO_CODE == "SPECIFIC_WORD") event.value = this.getField("Discount_Subtotal").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 ,
Oct 14, 2016 Oct 14, 2016
LATEST

Thank you.

Just tried it and worked just like we wanted it to.

Kindest Regards,

Don

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