2 Replies Latest reply on Sep 29, 2008 12:21 PM by Deepak_Hathwar

    TextInput.text property still has old value

    Deepak_Hathwar
      Hello,

      I have a form that contains repeated TextInput components using the repeater component. Also, I have an update button that when clicked, loops thru each text input button to see if the user entered a different value than the one stored in the "data" property of the text input. Here's is a snapshot of the code...

      for ( var i:uint = 0; i < textInputs.length; i++) {
      var currentItem:TextInput = textInputs ;
      if (currentItem.text != currentItem.data) { //This is not the exact code but close....
      //Add this value to an update array that will be sent to backend for DB update.
      }
      }

      The problem is that when I change multiple text fields, the UI shows the changed values. However, when I click the update button (and this code is executed), currentItem.text returns the original value for all text inputs other than the first one that I changed. For e.g., if I changed the value in the 5th text input first and then the 3nd text input second, then currentItem.text shows that the 5th text box had the changed value but the 3rd text box still has the original value even though the UI shows the new value. This makes no sense at all. Can someone tell me what I could be doing wrong?
        • 1. Re: TextInput.text property still has old value
          ntsiii Level 3
          Show a little more code, like your repeater declaration.

          Use the "AttachCode" button (Must use "Reply" link, not "quick Reply")

          I loop over repeated items regularly and do not have any problem. yo have some other code that is causing a problem.

          Probably does not matter here, but don't use built-in object or property names for your stuff, like "currentItem". It is a bad practice that will cause problems some day.

          Tracy
          • 2. Re: TextInput.text property still has old value
            Deepak_Hathwar Level 1
            The UI Code as well as the action script code is attached to this reply.

            If you look at updateProperties() function at the following line:
            var uiText:String = StringUtil.trim(currentItem.text);

            uiText still contains the value when the form was loaded even though on the UI I see the new value that I typed in. This is really strange.