1 Reply Latest reply on Mar 16, 2007 3:45 AM by ggshow

    dynamic textfield

      I want to create 4 dynamic text field at runtime using for loop.
      for (i=1;i<4;i++) {
      strtxt = "mytext"+i+"_txt";
      this.createTextField(strtxt, txtid, 40, xpos, 100, 20);
      strtxt.text = "Data";

      But this is not working. Any idea to create as many text fields in runtime
        • 1. Re: dynamic textfield
          ggshow Level 2
          1st mistake:
          for (i=1;i<4;i++) { this create only 3 text field but not 4.
          you should use for (i=1;i<=4;i++) { or for (i=1;i<5;i++) {

          2nd mistake:
          variable txtid & xpos are undefined.

          3rd mistake:
          you should set the text using this[strtxt].text instead of strtxt.text

          try attached script