Expand my Community achievements bar.

SOLVED

Dynamic copy from between fields?

Avatar

Level 8

I have 2 text fields, side by side, their caption is fld_1 and copy_of_fld_1.

copy_of_fld_1 is greyed out and readOnly.

As user is entering the data in fld_1, immediately that data should be copied to copy_of_fld_1, it should be dynamic reflection

I tried in Change event, exit event, but not working!! May be am wrong

Pls. let me know the Java Script how to copy from fld_1 to copy_of_fld_1 dynamically, as user entering the data?

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You can achieve something similar without scripting, using the Global binding.

You would need to give both fields the same name "fld_1". Then select one of the fields and go to the Object > Binding palette. Set the binding to global and when the user inputs a value into the open field, it will automatically appear in the readOnly field (on exit).

If you need to have the data appear in realtime as the user is typing, then this JavaScript in the change event of fld_1 should work okay:

copy_of_fld_1.rawValue = xfa.event.newText;

Hope that helps,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

You can achieve something similar without scripting, using the Global binding.

You would need to give both fields the same name "fld_1". Then select one of the fields and go to the Object > Binding palette. Set the binding to global and when the user inputs a value into the open field, it will automatically appear in the readOnly field (on exit).

If you need to have the data appear in realtime as the user is typing, then this JavaScript in the change event of fld_1 should work okay:

copy_of_fld_1.rawValue = xfa.event.newText;

Hope that helps,

Niall

Avatar

Level 8

Thank you, i am goiing with the provided JavaScript