When using a Feature Layer, applyedits fires multiple times

I'm using a feature layer that is editable and when a new feature is added, I'd like to prompt the user with a dijit dialog box to confirm they want to add the new feature to the database. This works fine when only one feature is added during a editing session, but if more than one is created, the applyedits function is fired multiple times and all the features in the editing session are duplicated with each new feature. I used Firebug to see the multiple POST events are firing when I think there should only be one call to applyedits. The duplicated features will also have an ObjectID this is out of sequence with the others.

I've tried omitting the dialog box and it work as expected. I've tried clearing the default map graphics layer and the feature layer with no success. Where are they hiding! I've also modified an editing example from Esri and ran into the same problem. Any advice is appreciated!

I can see one problem. You defined the event handlers for yesAddButton and noAddButton inside the callback function of draw-end event. So every time when you draw a graphic, yesAddButton and noAddButton event handlers will be defined one time. It will end up that if you draw two graphics, applyEdits will be triggered twice; three graphics, call applyEdits three times, and so on.

More than likely, applyEdits is triggered multiple times. Without looking at the code, it's hard to tell how multiple triggers are defined. Can you post your code? It would be great if you can post your code in jsFiddle.

I can see one problem. You defined the event handlers for yesAddButton and noAddButton inside the callback function of draw-end event. So every time when you draw a graphic, yesAddButton and noAddButton event handlers will be defined one time. It will end up that if you draw two graphics, applyEdits will be triggered twice; three graphics, call applyEdits three times, and so on.

Thank you, zj_zou! Your advice did the trick! I moved the yesAddButton and noAddButton event handlers to a different location in the code so they're only defined once. Now, my original application is working as expected!