views:

272

answers:

3

I'm trying to display query data into multiple TextInput Fields in Flex.

<mx:TextInput id="stagInput" text="{acContacts}" width="170" x="120" y="74"/>

This is what I'm trying but all that displays is [object Object]

I think I need to define the database field I'm wanting to display, but I'm unsure how to do this as TextInput fields don't support dataField or labelField properties. Is there another property I don't know about?

How do i go about fixing this?

Thanks!

A: 

Is acContacts the object? You can try {acContacts.label} or {acContacts.name} (or whatever attribute you wish to display).

CookieOfFortune
Sorry acContacts is ArrayCollection.For example I'd like to display the field fname from the database but just adding {acContacts.fname} the way you suggested doesn't seem to do the trick.Any other thoughts?
Adam
What is an ArrayCollection of? Can you give me a description of your data?
CookieOfFortune
The array collection is a query to a database containing fields like first name and last name... I'm post my code in an answer.
Adam
I'd suggest to override the toString():String function. You can create a small subclass for it.
itarato
A: 

Ok here's a bit more of my code

[Bindable]
private var acContacts:ArrayCollection;
private function retrieveData():void { //RETRIEVE DATA
    var stmt:SQLStatement = new SQLStatement();
    stmt.sqlConnection = sqlConn;
    stmt.text = "SELECT * FROM tbl_person WHERE person_id=1";
    stmt.execute();
    var result:SQLResult = stmt.getResult();
    acContacts = new ArrayCollection(result.data);
}

<mx:TextInput id="stagInput" text="{acContacts}" width="170" x="120" y="74"/>

The data comming from the query is information like first and last name, email, website .ect

I realize that my query currently has a hardcoded id but right now I'm just trying to get the users information displaying individual Textinputs - eg. one for first name one for last name .ect

Hope this explains my problem a bit better.

Thanks Again!

Adam
A: 

Here's what I was looking for

[Bindable]
    private var acCon:ArrayCollection;

    private function reData():void //RETRIEVE DATA
    {
        var stmt:SQLStatement = new SQLStatement();
        stmt.sqlConnection = sqlConn;
        stmt.text = "SELECT * FROM person";
        stmt.execute();
        var result:SQLResult = stmt.getResult();
        acCon = new ArrayCollection(result.data);
    }

<mx:Repeater id="repeater1" dataProvider="{acCon}"> 
<mx:Label id="Label1" text="{repeater1.currentItem.lastname}"/>

Adam