1 Reply Latest reply on Oct 4, 2010 10:00 PM by BhaskerChari

    Creating a dynamic Text Input in a form with link button

    iamcootis Level 1

      I have seen an article about this before, but I can't seem to find it now. I'm trying to create a textInput with a link button below it that says "add another item." I want to be able to create a form that is dynamically generated by the user. And can grow to however many times the user clicks add another.


      Has anyone else seen this article? Or have any idea about the best way to go about designing this?


      Thanks for your help.

        • 1. Re: Creating a dynamic Text Input in a form with link button
          BhaskerChari Level 4

          Hi Cootis,


          You can simply take one conatiner and create the textInput dynamically at runtime in ActionScript. Check the sample simplest  code below..



          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
               private var arrayCollectionList:Array = new Array();
               private function addTextInputToForm() : void
                 var textInput:TextInput = new TextInput();
                 textInput.width = 250;
                 textInput.height = 25;

          <mx:VBox verticalGap="5" horizontalCenter="0">
            <mx:VBox id="boxContainer" verticalGap="5">
             <mx:TextInput id="txtInput" width="250" height="25" /> 
            <mx:LinkButton id="lnkButton" label="Add Another Item" width="250" click="addTextInputToForm();" />