Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Community Beginner ,
May 08, 2012 May 08, 2012

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

TOPICS
ActionScript
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 08, 2012 May 08, 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.

}

Translate
Community Expert ,
May 08, 2012 May 08, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 08, 2012 May 08, 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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2012 May 08, 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.

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 08, 2012 May 08, 2012

That is awesome, can't believe its so simple! The = connects the two...

Fantastic, thanks for your help kglad!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2012 May 08, 2012
LATEST

you're welcome.

p.s.  please mark helpful/correct responses.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines