5 Replies Latest reply on Dec 20, 2006 3:14 PM by nicetim

    Missing data in Model

    nicetim Level 1
      Hi,
      I am using CF type project. i am using remote objects with remote classes.
      i can call my methods on my remote and data is returned and populates a model bound to the class.
      eg <myclass:myfield>{formfield.text}</myclass:myfield>

      Most of the data is showing in my form fields but not all of it.
      i have about 3 that always display nothing.

      in my result event from the remoting call i have:

      <code>
      var detail:Users = event.result as Users;
      this.userModel = detail;
      Alert.show(ObjectUtil.toString(this.userModel.tags));
      </code>
      This works and the values are in the model.
      then later on in the code, i have my actual field.

      <mx:textinput text="{this.userModel.myTags}" id="tags"/>
      always shows nothing.

      here is my model definition:

      <assets:Users id="userModel">
      <assets:myTags>{tags.text as String}</assets:myTags>
      </assets:Users>

      HELP!!!

      thanks in advanced.


        • 1. Re: Missing data in Model
          nicetim Level 1
          Please, can anyone assist with this??

          i can not figure out why the data is not available to the form fields. It is in the data set, and gets added to the model.

          HELP!!!!

          tim
          • 2. Re: Missing data in Model
            buabco
            have you tryed replacing {tags.text as String} for an actual string, it looks like you have bounded both the data model and the textfield to each other, in wich case it might be posible that the textfield is setting to empty your datamodel.
            • 3. Re: Missing data in Model
              nicetim Level 1
              Hi thank you for the post.

              i tried what you suggested and that does some how make the data magically appear. but now when i save my model back to the server, the changed data is not in the model.

              any suggestions?

              btw, i followed a file created by the FB2 crud wizard.
              it had a model with all the form fields bound in it, then all the form fields bound back to the model.
              This is the way my file is as well, and most of the fields work but a few at the end of the model.

              thanks again for taking a crack at this.

              tim
              • 4. Re: Missing data in Model
                buabco Level 1
                Nicetim,

                I don't have much experience with the data model, I've used it in my forms but since the data from the server requiered some checks before posting it into the form fields, I've just used datamodels in a one way (FORM to MODEL) direction. My guess is that the data binding for your code is somehow changing the model before the model can change the field.

                I see two choices for you:

                1.- Try to look in your code for commands that can change the model or field, it's probable that one of this is firing before the binding update.

                2.- Use a one Way approach on your model, by adding code so for example, the model will be updated only when you push the SEND button on the form.
                • 5. Re: Missing data in Model
                  nicetim Level 1
                  Hi Buabco,
                  thanks again for the reply.

                  as i said, i have scrapped the whole model concept because it is just not working as advertised.

                  I am now setting the fileds dataProviders and text fields with the results from my RO calls.

                  This is all now working, except for a mulit select List box.

                  I can not figure out how to set the selected Items. do you have an example for this?

                  i am using an Arraycollection as the dataProvider to the list. then on CreationComplete() i loop over the DP and try to set the selectedItems array, but i get null pointer errors.

                  Thanks again

                  Tim