Put in the action formula:
FIELD SAVEOPTIONS:="0";
@postedcommand([filesave])
Note there should be a field on the form called "SaveOptions" withe value "1" and it should be editable.
Alternatively you can put in the formula:
r:=@command([filesave]);
REM "if r=0 then save has failed due to querysave or input validation checks.";
@If (r=0;@Return("");"");
@postedcommand([filesave]);
@postedcommand(fileclosewindow])
or a combination:
r:=@command([filesave]);
REM "if r=0 then save has failed due to querysave or input validation checks."
@If (r=0;@Return("");"");
FIELD SAVEOPTIONS:="0";
@postedcommand(fileclosewindow])
In the discard changes button you can put:
FIELD SAVEOPTIONS="0"
@postedcommand(fileclosewindow])