Expand my Community achievements bar.

How do I commit changed data in a form?

Avatar

Level 2

Since all of the videos I need regarding working with data (Flex 4 beta in a week, Day 4 onwards) are not done yet, I'm asking these most basic questions here.

I have successfully built a form, it is populating with data correctly from the back end DB.  I can edit the data.  I now want to post my updates back to the database.  I'm connected to ColdFusion 9 and I have built all the functions for insert, update, and delete in the .cfc.  In Flash Builder 4, I have done an "enable data manament" on the data type that represents a record in the table I am editing. I don't know how to commit changed data back to the DB.

I would like to put a "Commit" button on my form somewhere and in the click event I would write what?

2 Replies

Avatar

Level 2

When the form first opens up, I do this:

protected function panel1_updateCompleteHandler(event:FlexEvent):void
            {

                getSBJResult.token = baa_data_svc.getSBJ('...My subject Identifier');
            }

The user then makes a change in the form data and wants to commit it to the back end DB.  I use this:

            protected function btnCommit_clickHandler(event:MouseEvent):void
            {
                baa_data_svc.updt_SBJ(bAA_SBJ);   
            }


This writes the data back to the DB.  It works.  does anyone see anything wrong with this method?

Avatar

Level 2

This is only a partial answer.  It commits data, but causes an error next time the user tries to open the form.  I still need to know the correct way of Commiting data.