0 Replies Latest reply on Jun 5, 2010 2:27 PM by RealBillyBlue

    Bind a form with dynamical data -> select right position?

    RealBillyBlue Level 1

      Hey,

      I've create a new project in Flash-Builder 4 and bind it via PHP-Assistant to a database.

       

      Now I add a form via Form-Assistent in FB4 - works fine, but the forms always shows me only the first entry of the DB.

       

      How can I tell Flex in realtime, which row the form should shows?

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                        xmlns:s="library://ns.adobe.com/flex/spark" 
                        xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:adressesservice1="services.adressesservice1.*" xmlns:valueObjects="valueObjects.*">
           
      <fx:Script>
                <![CDATA[
                     import mx.controls.Alert;
                     import mx.events.FlexEvent;
                     
                     protected function list_creationCompleteHandler(event:FlexEvent):void
                     {
                          getAllAdressesResult.token = adressesService1.getAllAdresses();
                     }
                     
                     
                     protected function button_clickHandler(event:MouseEvent):void
                     {
                          adresses.Name = nameTextInput.text;
                          adresses.Firstname = firstnameTextInput.text;
                     }
                     
                ]]>
      
           
           </fx:Script>
           <fx:Declarations>
                <s:CallResponder id="getAllAdressesResult" result="adresses = getAllAdressesResult.lastResult[0] as Adresses"/>
                <adressesservice1:AdressesService1 id="adressesService1" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
                <valueObjects:Adresses id="adresses"/>
           </fx:Declarations>
      
           
           <s:List x="189" y="194" width="692" height="234" id="list" creationComplete="list_creationCompleteHandler(event)" labelField="Name">
                <s:layout>
                     <s:TileLayout/>
                </s:layout>
                <s:AsyncListView list="{getAllAdressesResult.lastResult}"/>
           </s:List>
           
           
           <mx:Form defaultButton="{button}" x="414" y="454">
                <mx:FormItem label="Name">
                     <s:TextInput id="nameTextInput" text="{adresses.Name}"/>
                </mx:FormItem>
                <mx:FormItem label="Firstname">
                     <s:TextInput id="firstnameTextInput" text="{adresses.Firstname}"/>
                </mx:FormItem>
                <s:Button id="button" label="Send" click="button_clickHandler(event)"/>
           </mx:Form>
      </s:Application>
      

       

      I know that the line

       

      <s:CallResponder id="getAllAdressesResult" result="adresses = getAllAdressesResult.lastResult[0] as Adresses"/>

       

      sets it to the first row - now I've to know, how to change the row at realtime.

       

      Thank you!!

      - bb