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

Run Code once on form load

Anonymous
Not applicable

Hi Guys,

I have a text field (TextField1)  that populates with a value (1-100)

On initial load of the form this value will be the highest.

As the user navigates around the form this number will change (lower than the initial load)

I have another text field (TextField2) on the form which I want to hold the initial value at load of the form.

something like: TextField2.rawValue = TextField1.rawValue

But whichever event I put it in it always updates TextField2 with the value in TextField1 (it does not only run the code once on form load)

Can anyone advise how I can achieve this?

If the form loads with the number 70 as a value in TextField1 - TextField2 has 70 as a value and keeps that value regardless of what TextField1 changes to..

Many thanks for any help

1 Accepted Solution
whyisthisme
Correct answer by
Level 7
Level 7

try putting in the docReady event of TextField2:

$ = TextField1.rawValue

View solution in original post

0 Replies
whyisthisme
Correct answer by
Level 7
Level 7

try putting in the docReady event of TextField2:

$ = TextField1.rawValue

View solution in original post

Anonymous
Not applicable

Thanks whyisthisme,

I tried this,

The form loads and both fields show the latest number (70)

but when TextField1 is changed the value in TextField2 disappears?

it does not repopilate even if I repopulate TextField1 with the original value (70)

Thanks for your help

whyisthisme
Level 7
Level 7

Is there any other code in or relating to TextField2?

Anonymous
Not applicable

Ok - after a closer look i think I have found it.

The docReady event works fine and the form locks off if i manually change the value in TextField1.

As part of the script that changes the value in TextField1 there is an xfa.form.remerge() and I think this is what is stopping it from working.