Start to create a user then cancel out . it persists a phantom record with no details . is there a simpler way other than ripping out the save and cancel provided by mendix and writting our own save and cancel to handle the issue.
Ripping out the save and cancel buttons provided by Mendix is possible. If you don't want to use the standard save and cancel buttons, you could start writing your own save and cancel action triggers.
The following actions are needed:
Set the form's property 'Show control bar' to 'false' (ripping out the standard save and cancel buttons);
Add a row with at least two empty cells to your form;
Put an action trigger in one cell. Rename this to save, connect an image (Save) to this button and more important, connect your microflow which include the preferred save logic;
Put an action trigger in the other cell. Rename this to cancel, connect an image (Cancel) to this button and more important, connect your microflow which include the preferred cancel logic;
In your customized save microflow you have to set the prefered values and associations by yourself. No standard logic is automatically handled.
Probably in your case a rollback object activity would be sufficient in your customized cancel microflow.
If the case is more advanced, it would highly depend on the actions you would like to simulate in that microflow whether you have to use rollback or delete in your custom cancel microflow action.
If this microflow only creates the object and doesn't commit the object, it would be sufficient to use a rollback. Since the release of the 2.4.4 version of the Mendix Business Modeler, a default action is available "object / rollback".
If it commits the object, you should remove the object instead of just calling a rollback. Rollback will not remove the object because it isn't 'new' anymore after the first commit.
Hope this will be helpful!
If you use a default new button of a datagrid and hit cancel, the datagrid should automatically refresh and thus the phantom record should dissapear.