2 Replies Latest reply on Mar 13, 2010 9:49 AM by JohnMerlino

    database not updating

    JohnMerlino Level 1

      I created a form in actionscript in a flash builder application. I set the text property to a column in my database. When I click update, it doesn't update the input. This

       

      _text[2].text = "@{studentsGrid.selectedItem.gender}"

       

      nor this:

       

      _text[2].text = studentsGrid.selectedItem.grade

       

      will update the database. The latter displays the data from the database but does not update. However, I do know that the update is working because I have other transactions occuring that do make changes to database, just the user input is not updating.

       

       

      Here's more code:

       

                  private function changeState():void {
                     
                      var form:Form = new Form();   
                      form.x = 350;
                      form.y = 330;
                     
                      var formItem:FormItem;
                      var textInput:TextInput;
                      var button:Button = new Button();
                      button.x = 350;
                      button.y = 300;   
                      button.label = "Update"
                      var inputX:Number = 312
                      var inputY:Number = 250   
                     
                      for (var i:Number = 0; i < 2; i++) {
                         
                         
                         
                          var formItem = new FormItem();
                          var textInput = new TextInput();
                          textInput.x = inputX;
                          textInput.y = inputY * 75;
                         
                          form.addElement(formItem)
                          formItem.addElement(textInput)
                          _form.push(formItem)
                          _text.push(textInput)   
                         
                      }
                     
                      addElement(form)
                      addElement(button)
                      button.addEventListener(MouseEvent.CLICK, updateState);
                     
                      form.id = "detailView"
                      form.label = "Pass Student";
                      _form[2].label = "Gender";
                      _form[3].label = "Grade";
                      _text[2].id = "genderTextInput";
                      _text[3].id = "gradeTextInput";
                      _text[2].text = "@{studentsGrid.selectedItem.gender}";    
                      _text[3].text = "@{studentsGrid.selectedItem.grade}";
                     
                  }

       

                  private function updateState(event:MouseEvent):void {
                     
                      studentsPass.send(studentsGrid.selectedItem)

       

                  }

       

      Any ideas? Thanks.

        • 1. Re: database not updating
          JohanVelthuis Level 1

          I just replied to another post of you and I think you should really consider to

          access the dataservice directly in your form and not try to update something

          in the datagrid.

          when you do something like myService.commit(); then it will update your database.

          • 2. Re: database not updating
            JohnMerlino Level 1

            The form depends on which item in the data grid is selected. The data grid is defined in the application, because other forms will be depending on that datagrid as well. So there needs to be a connection between form and datagrid. I replied back to that question in the other post. I get:

             

            "Access of possibly undefined property application through a reference with static type Class"

             

            for the line below in the main application:

             

            var titleWin:* = PopUpManager.createPopUp(DisplayObject(Application.application.parentDocument), popupClass, true) as popupClass;