Editable form fields, and validation formula (@-code)

This, I haven’t (yet) verified on other Platforms but Windows 7 (64 bit) Notes 9.0.1 FP2, but I guess it would be the same all over.

I have a form with one field: AuditNote

Its defined as an Editable Text-field.

I want to Validate, based upon Roles, the AuditNote field to have content. This is the Validation code:

REM {NB ! Makes us of the ThisValue and ThisName @-functions};

REM {Use Debugger as described in Notes Net article:};

REM { Create your own formula debugger, by Craig Lordan, Dec. 1999};

REM {Tip: Remember always to convert to text in prompts especially after Lookups};

Debug := @If(@Environment(“AllDebug”) = “Yes”; @True; @False);

AdminUser := 0;

AdminUser := @If(@IsMember(“[DBAdmin]”; @UserRoles);@True;@IsMember(“[xx-Admin]”; @UserRoles);@True;@False);

@If(Debug; @Prompt([Ok]; “Debug Pre 1”; "Roles assigned to current user (Admin “+@Text(AdminUser)+”) roles: " + @NewLine + @Implode(@UserRoles; “;”)); @Success);

@If(AdminUser = 1;@Success;

@ThisValue="";@Failure("Saving a document, requires an explanation in the "+@ThisName+" field");

@Success)

The problems I have found is the following two, of which the first is the most annoying which I believe is a bug:

The Validation is driven when I Open a document created with this Form, in Edit mode - before the user (poor me) has tried to Refresh, Edit something or anything !!!
I added : @IsDocBeingSaved as criteria too, without luck it looks as the document gets saved (but really, it doesn’t based on Revision history) ?!!
So I can’t make Validation @code that checks (that’s what validation is for) missing information !
(and no, there is no Automatic refresh in the form properties, nor calculations in preceeding fields that trigger refresh). I get this prompt (from the @Failure statement), whenever I do Document Edit:

Second, the Prompt (useful for Debugging) seems in Notes 9 to allow far less data to be displayed !
In above example, I have seen 482 characters being displayed in the Prompt !
The Designer Help 8.5 (thank god its still on my Client, the Notes 9 designer is useless as I see it) says this for the Prompt function:
“…The maximum number of characters you can include in the text that displays is 255…”
I’m sure my Notes 8.5* was able to display almost twice or more (can’t reproduce, I have gone to Notes 9…)

Subject: Filed as a PMR with IBM today,…

using the SPRID (Internal field, of the Parent document) PROG9PADS9 as the Customer Ticket Reference.

Subject: Had to withdraw PMR ! Could not reproduce it consistently any longer :frowning:

It sounds as bad news, but its not.

I might have had some Debug sessions over e period of hot-restarts of my Win7 Designer client, so I guess I came across the kind of ‘memory leak’ problem that shows by completely never seen and weird errors.

After I filed the PMR, I was asked to deliver a sample to re-produce the symptoms, which is fair, but I could no longer !

The good news is, that the intended code for @Evaluation formulas can be made as one hoped for.

Subject: A temporary workaround, until its fixed by IBM could be…

As mentioned, I have tried a number of attempts and variations that seems odd, compared to the behaviour of Notes 3 - versions up to and incl. Notes 8.5.+: See Reference below.
The evidence I have, shows that the Validation code is driven not only when a document is Saved, Recalculated or Refreshed but also when document is opened in Edit mode !

I found out, I can temporarily, make this workaround (with blue markup) as long I’m am not going to maintain forms and code for all our legacy databases:

@If(AdminUser = 1;@Success;@IsDocBeingRecalculated;@Success;
@ThisValue=“”;@Failure(“Saving a document, requires an explanation in the “+@ThisName+” field”);
@Success)

The backside of this workaround, is that the normal behaviour of getting fields checked, is deferred to the time when user tries to Save.

Reference:
From Notes 8.5.2 Designer Help

Notes Link → here Notes:///85257608004F5587/F4B82FBB75E942A6852566AC0037F284/7DC4F69DED3A275A85257607005F5970 to the ‘Editable Field Formulas’ entry, of which I excerpt this:

  • The input validation formula checks the contents of a field against predefined criteria, making sure the entry meets certain requirements. For example, use an input validation formula to ensure that users fill in a required field. Input validation formulas are evaluated each time a document is saved, recalculated, or refreshed.