burga
03-16-2011, 11:10 AM
First off, my project is in Flex 4, and uses PHP and an SQL database to submit and receive information, the submitting of data is working an I'm happy with it.
It currently uses the prototyped PHP script from flashbuilder (separate devs working on that aspect) and the ZendFramework)
However the retrieval is proving a little tricky.
Essentially I have a comboBox, which is searching my SQL database by name(one of my fields) using labelField and I have a changeHandler which then sends the ID of that element to my textArea, the textArea, should then be displaying another field from the element.
My Database structure:
dedicationID - unique auto-incremental field
RecipientName
RecipientEmail
SenderName
SenderEmail
Message
With the code I have currently, which i'll post at the bottom, I can search the db, and when I select an entry, all I get is the ID of the element in my textArea, instead of the Message which i'm trying to retrieve.
protected function comboBox_creationCompleteHandler(event:FlexEvent): void
{
getAllDedicationResult.token = dedicationService.getAllDedication();
}
protected function comboBox_changeHandler(event:IndexChangeEvent):voi d
{
textArea.text = textArea.text + comboBox.selectedIndex
}
protected function textArea_creationCompleteHandler(event:FlexEvent): void
{
getDedicationByIDResult.token = dedicationService.getDedicationByID(comboBox.selec tedIndex);
}
^ my functions
<s:ComboBox includeIn="home" x="31" y="94" id="comboBox" creationComplete="comboBox_creationCompleteHandler(event)" labelField="RecipientName"
change="comboBox_changeHandler(event)">
<s:AsyncListView list="{getAllDedicationResult.lastResult}"/>
</s:ComboBox>
<s:TextArea includeIn="home" x="686" y="168" id="textArea" creationComplete="textArea_creationCompleteHandler(event)" text="{getDedicationByIDResult.lastResult.Message}"/>
^ my MXML code
Ideally functionality wise, when an entry is selected it should go to a new state with 3 textAreas, each retrieving RecipientName, SenderName and Message respectively, all from the same ID.
And then one final aspect of my project I wish to implement, is a count() function, which adds a graphic for every entry that is in the database.
Thanks
It currently uses the prototyped PHP script from flashbuilder (separate devs working on that aspect) and the ZendFramework)
However the retrieval is proving a little tricky.
Essentially I have a comboBox, which is searching my SQL database by name(one of my fields) using labelField and I have a changeHandler which then sends the ID of that element to my textArea, the textArea, should then be displaying another field from the element.
My Database structure:
dedicationID - unique auto-incremental field
RecipientName
RecipientEmail
SenderName
SenderEmail
Message
With the code I have currently, which i'll post at the bottom, I can search the db, and when I select an entry, all I get is the ID of the element in my textArea, instead of the Message which i'm trying to retrieve.
protected function comboBox_creationCompleteHandler(event:FlexEvent): void
{
getAllDedicationResult.token = dedicationService.getAllDedication();
}
protected function comboBox_changeHandler(event:IndexChangeEvent):voi d
{
textArea.text = textArea.text + comboBox.selectedIndex
}
protected function textArea_creationCompleteHandler(event:FlexEvent): void
{
getDedicationByIDResult.token = dedicationService.getDedicationByID(comboBox.selec tedIndex);
}
^ my functions
<s:ComboBox includeIn="home" x="31" y="94" id="comboBox" creationComplete="comboBox_creationCompleteHandler(event)" labelField="RecipientName"
change="comboBox_changeHandler(event)">
<s:AsyncListView list="{getAllDedicationResult.lastResult}"/>
</s:ComboBox>
<s:TextArea includeIn="home" x="686" y="168" id="textArea" creationComplete="textArea_creationCompleteHandler(event)" text="{getDedicationByIDResult.lastResult.Message}"/>
^ my MXML code
Ideally functionality wise, when an entry is selected it should go to a new state with 3 textAreas, each retrieving RecipientName, SenderName and Message respectively, all from the same ID.
And then one final aspect of my project I wish to implement, is a count() function, which adds a graphic for every entry that is in the database.
Thanks