3 Replies Latest reply on Mar 7, 2013 5:57 AM by OchirErdene

    Flash builder + Zend amf | Insertion function not working when called second time

    armandsar

      I'm using standart createOrders function which is autogenerated by Flash Builder 4.6. It works brilliantly when used once. Here is code:

      protected function okButton_clickHandler():void

                  {

                      var orders2:Orders = new Orders();

                      //setting values

                      createOrdersResult.token = ordersService.createOrders(orders2);

                      ordersService.commit();

                  }

       

      When same button is clicked second time and consequently okButton_clickHandler launched, data is not inserted to database. I added result handler with trace("saved"); and what I saw was that "saved" was written on first click, but not second.

       

      Also I used Charles to see whether request is being sent second time. And no it is not.

       

      Just tried to generate auto generate form. Only had to add commit(); because else request is not sent. And here is save problem — request is sent only on first button click.

       

      So all in all problem is in fact that ordersService.createOrders(orders2); works only once. Because if i try

      createOrdersResult.token = ordersService.createOrders(orders2);

                      ordersService.commit();

                      createOrdersResult.token = ordersService.createOrders(orders2);

                      ordersService.commit();

      OR

                  createOrdersResult.token = ordersService.createOrders(orders2);

                  createOrdersResult.token = ordersService.createOrders(orders2);

                  ordersService.commit();

       

      there is only one row added to database. Any ideas?