Expand my Community achievements bar.

Two NumericFields total 100%... how?

Avatar

Level 4

I would like to script (Javascript) two numeric fields so that the total percentage of the two equals 100%

For instance, if one field input is 45, on exit, the other field will be populated with 55.

I can get it to work from one textfield using the formula: NumericField1.rawValue = 100 - NumericField2.rawValue;

But it only works one way. If I use the formula: NumericField2.rawValue = 100 - NumericField1.rawValue; in the second field, that formula is ignored in favor of the first one.

An example is enclosed.

Any help would be appreciated.

Thanks,

Graham

An example is enclosed.

2 Replies

Avatar

Level 6

Hi,

I changed script a little and put it to onChange event.

See example.

BR,

Paul Butenko

Avatar

Level 4

Thanks Paul.

The xfa.event reference is new to me. I learn something new every time I ask a question here. Thanks!

Graham