Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Help with a script

Avatar

Level 7

Hi everyone,

I have a Conversion Numeric  filed with default: 1

I have a  Numeric field named: amount

A DDL named AddTax with 2 items(YES and NO )

On change event I have the script:

switch (xfa.event.newText)

case "YES":

tax.rawValue = 0.13*conversion.rawValue*amount.rawValue;

  break;

case "NO":

tax.rawValue = 0.00;

break;

 

At last I have another numeric field (Read only) named: tax


Everything works fine but in the case someone enters date to all fields but at the end

if has to change the conversion value from 1 to 2 for example, the value on the tax field remain the same!

I have to select the yes item in the DDL to update the tax.

There is another way so the tax field is always updated in case they change afterword the conversion field?


Thank you


1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

If I understand correctly I think you need to move your code to the calculate event of the tax field, something like;

switch (AddTax.rawValue)

{

   case "YES":

       this.rawValue = 0.13*conversion.rawValue*amount.rawValue;

       break;

   case "NO":

       this.rawValue = 0.00;

       break;

}

 

Regards

Bruce

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

If I understand correctly I think you need to move your code to the calculate event of the tax field, something like;

switch (AddTax.rawValue)

{

   case "YES":

       this.rawValue = 0.13*conversion.rawValue*amount.rawValue;

       break;

   case "NO":

       this.rawValue = 0.00;

       break;

}

 

Regards

Bruce