RakeshBhandari
asked on
How to read data from components having dynamically generated id
I have dynamically generated few components(TextBox) with dynamic ids.
Can anybody help me out about how to read data from these dynamically generated Components.
following is my code:
//On every button click i m adding these components to my titlewindow by calling this function.
public function lnkAdd(event:Event):void
{
QuantityCount=QuantityCoun
txtQuantityCount.text=Quan
//QuantityLabel
var lblQuant:Label=new Label();
lblQuant.id="lblQuantity"+
lblQuant.text="Quantity :";
lblQuant.x=20;
lblQuant.y=(lblQuantity1.y
lblQuant.name=lblQuant.id;
QuantityGrp.addElement(lbl
//Quantity TextBox
txtQuant=new TextInput();
txtQuant.id="txtQuantity"+
//txtQuant.text=txtQuant.i
txtQuant.x=71;
txtQuant.y=(txtQuantity1.y
txtQuant.restrict="0-9";
QuantityGrp.addElement(txt
//lblMainLocation
var lblMainLoc:Label=new Label();
lblMainLoc.id="lblMainLoca
lblMainLoc.text="MainLocat
lblMainLoc.x=201;
lblMainLoc.y=(lblMainLocat
lblMainLoc.name=lblMainLoc
QuantityGrp.addElement(lbl
//MainLocation dropdownlist
ddlMainLoc=new DropDownList();
ddlMainLoc.id="ddlMainLoca
//ddlMainLoc.labelDisplay.
ddlMainLoc.x=279;
ddlMainLoc.y=(ddlMainLocat
ddlMainLoc.dataProvider=Lo
ddlMainLoc.requireSelectio
ddlMainLoc.labelField="Mai
QuantityGrp.addElement(ddl
//lblSubLocation
var lblSubLoc:Label=new Label();
lblSubLoc.id="lblSubLocati
lblSubLoc.text="SubLocatio
lblSubLoc.x=415;
lblSubLoc.y=(lblSubLocatio
lblSubLoc.name=lblSubLoc.i
QuantityGrp.addElement(lbl
//SubLocation dropdownlist
ddlSubLoc=new DropDownList();
ddlSubLoc.id="ddlSublocati
//ddlMainLoc.labelDisplay.
ddlSubLoc.x=489;
ddlSubLoc.y=(ddlSublocatio
ddlSubLoc.dataProvider=Loc
ddlSubLoc.requireSelection
ddlSubLoc.labelField="SubL
QuantityGrp.addElement(ddl
//lblDescription
var lblDescript:Label=new Label();
lblDescript.id="lblDescrip
lblDescript.text="Descript
lblDescript.x=613;
lblDescript.y=(lblDescript
QuantityGrp.addElement(lbl
//Description textbox
txtDescript=new spark.components.TextArea(
txtDescript.id="txtDescrip
//txtDescript.text=txtDesc
txtDescript.x=678;
txtDescript.width=226;
txtDescript.height=59;
txtDescript.y=(txtDescript
QuantityGrp.addElement(txt
//lblDepartment
var lblDepart:Label=new Label();
lblDepart.id="lblDepartmen
lblDepart.text="Department
lblDepart.x=6;
lblDepart.y=(lblDepartment
QuantityGrp.addElement(lbl
//Department dropdownlist
ddlDepart=new DropDownList();
ddlDepart.id="ddlDepartmen
//ddlMainLoc.labelDisplay.
ddlDepart.x=71;
ddlDepart.y=(ddlDepartment
ddlDepart.dataProvider=Dep
ddlDepart.requireSelection
ddlDepart.labelField="Dept
QuantityGrp.addElement(ddl
//lblUsers
var lblUser:Label=new Label();
lblUser.id="lblUsers"+Quan
lblUser.text="Users :";
lblUser.x=229;
lblUser.y=(lblUsers1.y+(75
QuantityGrp.addElement(lbl
//Department dropdownlist
ddlUser=new DropDownList();
ddlUser.id="ddlUsers"+Quan
//ddlMainLoc.labelDisplay.
ddlUser.x=278;
ddlUser.y=(ddlUsers1.y+(75
QuantityGrp.addElement(ddl
}
As the ids are in string format i am not able to call it's(Textbox) text property to get their values.
Help appreciated,
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER