Skip to main content
June 20, 2016
Answered

Having field data auto-populate in a read only field later on

  • June 20, 2016
  • 1 reply
  • 1181 views

Hello,

I'm trying to create a part of my form where the user fills in a value (a number) to a text box field and that value is automatically populated in a read-only text box in a later part of the form. The read-only text should adjust as the user adjusts the original text, but it shouldn't be able to be adjusted itself (hence the read-only).

I haven't figured out a way to make this work (actions? calculate?) and none of the forums I've found seem to address this. I'm assuming I shouldn't just name them the same thing because then they will both have to be adjustable or read-only.

If someone knows how this can be done please let me know! Thank you all in advance!

This topic has been closed for replies.
Correct answer George_Johnson

Use the Validate event of the input field, something like:

// Copy this field value to the other field

getField("Text2").value = event.value;

but replace "Text2" with the actual name of the read-only field.

1 reply

George_JohnsonCorrect answer
Inspiring
June 20, 2016

Use the Validate event of the input field, something like:

// Copy this field value to the other field

getField("Text2").value = event.value;

but replace "Text2" with the actual name of the read-only field.

June 20, 2016

Thank you for the reply! I may not understand your answer completely, but it doesn't seem to be working. For example, in a budgeting form, I have an area the user can type in the amount spent - say on "groceries" - and later on it will compare the actual amount spent vs the amount budgeted.

I want the user to be able to enter in the amount budgeted for and later on, I want that amount (in a non-editable, read-only text box) to show up when compared with the actual amount spend. So, there will be an original box titled "Groceries" and a box later titled "GroceriesB" (B for budgeted which should be the read-only value from "Groceries") and "GroceriesA" (A for actual which will be a user input box for the actual amount spent on groceries).

In the GroceriesB validate tab I tried doing:

getField("GroceriesB").value = event.value;

But that did not work. I tried typing that into the "Groceries" validate tab but that also did not work. I tried replacing "event" with "Groceries" but that also still did not work.

Is there something I'm missing? Please let me know. Thank you again!

Inspiring
June 20, 2016

In your specific case, the Validate script for the Groceries field should be:

// Custom validate script for "Groceries" text field

getField("GroceriesB").value = event.value;