This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.

Dec 12, 2016, 9:37 AM
8 Posts
topic has been resolvedResolved

Input Validation, Control - S and @IsValid

  • Category: Application Development
  • Platform: Windows
  • Release: 9.0.1
  • Role:
  • Tags: @IsValid,Input Validation
  • Replies: 4

Does  anyone have suggestions for stopping a form from saving if the Field Input Validation fails ? I have Lotus Script Code that runs after QuerySave that I don't want to run or at least return a Continue = False to QuerySave. It appears the way Lotus Notes attempts to Catch Field Validation is with @IsValid in Action buttons or checking to see if something successfully saved. But a Control - S bypasses all the action Save and Exit button codes, so I can't stop it from advancing to QuerySave. Any suggestions ?  


I have Put Error catching in Lotus Notes to Catch Error 4412 after a Call source.Refresh(True). This seems to work but I am not sure if Error 4412 will catch all the Input Validation Errors. 

Any Suggestions - 

Thanks -  

Thomas Zink

Dec 13, 2016, 5:00 AM
108 Posts
First of all, I don't fully understand what your form does. Maybe you can elaborate a bit on this. For example, you are writing that there's some LotusScript code that runs after QuerySave, and that you want that code to return False to QuerySave. I don't see how that would be possible at all.

It's certainly a good idea to catch Error 4412, which is raised when a NotesUIDocument.Save() or NotesUIDocument.Refresh() fails due to a field validation error. Another suggestion is to never use NotesDocument.Save() -- i.e., the back-end Save operation -- when saving the document from LotusScript code that runs in the context of a form or subform, since that would bypass any validation.
Dec 13, 2016, 10:27 AM
8 Posts
File Save and Ctrl - S Can't be coded

I have a document approval process.  It should only advance to the next approval process after the first save AND exit.  The following approval processes advance on a button but the first one advances after saving and exiting.  One problem I have is I don't see a way to catch A Save or Ctrl-S if the user uses the File-Save button that doesn't have any code in it. - I've caught that with a On Error 4412. Thanks for the affirmation on this.

The next is something only happens if  the @Command(FileCloseWindow]) has been invoked on an Exit or Save & Exit.  - ISNewDoc changes after one successful save.

I am going to try populating a field value when I am exiting vs just saving.

Any tricks or suggestions out there ?


Dec 13, 2016, 4:05 PM
82 Posts
Not sure I understand ...
A document does NOT save if Field level input validation fails.  QuerySave will get trigged but the form document does NOT save.  You could set a form level variable in the querysave if the conditions you are expecting are not met and check that elsewhere in your code to prevent something else from happening.

Sample Field level input validation:
@If(@ThisValue="";@Failure("no good");@Success)
Dec 14, 2016, 8:45 AM
329 Posts
SaveOptions ?

I haven't done a lot of design work lately, but I've used the SaveOptions filed before - set to '0' on the form. If the user presses 'esc' they're not prompted to save, ctrl-S will not save the form. 

Then in my validation code, I set the field to '1' and save the form.

It's worked. at least, for what I was doing.

This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.