0 Replies Latest reply on Jul 11, 2007 9:12 AM by drofnasnhoj

    Dynamic Form generation display issues.

      I did some search in this forum as well as in Google and couldn't seem to find an answer to my problem. Hopefully somewhere here might be able to help.

      So what I have is a simple for on my page, something like ("-" = spaces, since spaces are disregarded):

      <mx:Form id="MainForm">
      ---<mx:FormItem label="test">
      ------<mx:TextInput />
      ------<mx:Button label="Submit" />

      Very simple form, just a text field and a button. But then I dynamically add more fields, as this form will be created from information in a database. So I call a simple method to add another FormItem:

      private function add_field():void {
      //create the form objects
      ---var row:FormItem = new FormItem();
      ---var field:TextInput = new TextInput();

      //add the text field to the form item
      ---row.label = "some really long name here";

      //add the child right before the button

      So, what I'm seeing is what when you add these children elements with different size labels you don't get the nice formatting that the Form element would normally provide if all of these fields were hard coded onto the page.

      Is there a way to refresh the Form (so it reformats itself) after I'm done dynamically adding all of the fields to it?

      Thanks for any help you can provide.

      * All of this code is from memory, not copy and paste, so please don't worry about any code errors as I know it works on my own machine. Just need to figure out the formatting issues.