Skip to main content
ChadThompson
Known Participant
May 8, 2012
Answered

How can I send text from an input field to another text field?

  • May 8, 2012
  • 1 reply
  • 1798 views

For example, I want to populate a row of data. I have one frame with input fields and another with the table. How can I connect the text fields so that when I hit submit, their values are sent to the other text fields?

Thanks

This topic has been closed for replies.
Correct answer kglad

you don't need a tutorial. you just use the text property of your input textfield to retrieve the text entered by your user and use the text property of your table textfield to display those data:

submit.addEventListener(MouseEvent.CLICK,submitF);

function submitF(e:Event):void{

table_tf1.text = input_tf1.text;  // where table_tf1 is the textfield where you want to display the text entered in input_tf1.text.

}

1 reply

kglad
Community Expert
Community Expert
May 8, 2012

you can't assign data to your table until it exists.  and you can't access data from your textfields after they cease existing.

so, if there's no time/frame when both exist at the same time, store the textfield values in a variable (an array) or variables.  when your table exists assign those variable values to your table.

ChadThompson
Known Participant
May 9, 2012

Thanks kglad,

If it makes the function easier, I can put the input field and the text field they will populate on the same frame, so the 'exist' at the same time.

That said, how can I send the input value from one field to the other? What kind of function would populate a text box? I'm not sure how to search for this kind of tutorial...

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 9, 2012

you don't need a tutorial. you just use the text property of your input textfield to retrieve the text entered by your user and use the text property of your table textfield to display those data:

submit.addEventListener(MouseEvent.CLICK,submitF);

function submitF(e:Event):void{

table_tf1.text = input_tf1.text;  // where table_tf1 is the textfield where you want to display the text entered in input_tf1.text.

}