0 Replies Latest reply on Oct 28, 2010 12:01 AM by livletdie77

    Issue in Accessing Values from a DataBean




      I have a form which includes the User Information when you insert the user Id on to a field. When you enter the user Id in the field and submit the results get inserted into a  UserInfoBean class in java. The UserInfoBean object is retrieved to the getUserDat() in flex. The first time I do this it assignes the data to the  "userInfo" and I include this into the fields as

                                 <s:TextInput id="firstNameId" text="{userInfo.FirstName}"/>


      The issue I am having is IF I do move to another section and comeback and try to look for another user the "userInfo" becomes NULL but the results.getItemAt(0) has data object UserInfoBean. When I try to print inside the getUserData() the userInfo.FirstName I get Null since the userInfo is NULL and results.getItemAt(0).FirstName I get the values.


      The code is attached below.


      Is there a way to fix this issue? How should I get the result into the userInfo?


      Thank you,






      MXML Code


      <fx:Script source="UserScript.as"/>


      <services:DepositInfo id="userData" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
      <s:CallResponder id="getUserDataResult" result="getUserData (event)"/>

      <s:Label text="User Id:" id="userIdLb"/>  <s:TextInput id="userId" text=""/>
      <s:Button label="Show" id="showBtn" click="


      <s:TextInput id="firstNameId" text="{userInfo.FirstName}"/>

      <s:TextInput id="lastNameId" text="{userInfo.LastName}"/>

      <s:TextInput id="emailId" text="{userInfo.Email}"/>


      ActionScript Code


      [Bindable] public  var userInfo:UserInfoBean = new UserInfoBean();

      private function loadUser(){

      getUserDataResult.token = userData.getUserInfoData(userId.text.toString());


      private function getUserData (event:ResultEvent):void{
          var results :ArrayCollection;
          results=event.result as ArrayCollection;
          if(results.length != 0){
              userInfo=results.getItemAt(0) as UserInfoBean;