I hardly ever see the @IsValid function used in actions that try to Save and Close a document.
Here is the problem:
1. User clicks Save & Close action button.
2. The @Command([FileSave]) tries to save the form. When it fails validation it returns the @Failure message.
3. The user clicks on OK on the failure message and the formula continues with the @Command([FileCloseWindow]) command.
4. This causes a File Save window to appear, if the user clicks yes, the validation is run again.
To Fix this use the following code:
When a user clicks on Save and Close.
- The most frequent code for "Save & Close" button is:
@Command ([FileSave]); @Command ([FileCloseWindow]);
But if the document cannot be saved (due to input validation errors), you will get a "save document?" message box caused from the FileCloseWindow command.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
This tip suggests using @IsValid to check if the document can be saved. But there is a better way to do this: The @Command([FileSave]) returns a value: @True, when successful, @False otherwise.
So the shortest and best code for an "OK" or "Save & Close" Action is:
@If (@Command([FileSave]);@Command([FileCloseWindow]);"")Hans-Peter Kuessner