Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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