Input Validation & Strange Behavior

We have a seemingly simple input validation formula… the problem is it seems (does it with all fields) to validate when the document is created (before any saves!). e.g. I use “Create Doc” button to create new document. All seems fine until you click the mouse in a field… and BAM → it pops up the validation message followed by a Notes message re: validation error. Any ideas?

@If(NoContactReason=“Not Applicable” & CallCustomer=“” | CustomerProds=“”;@Failure(“Missing Data - Please Check Required Fields”);@Success)

Subject: Input Validation & Strange Behavior

There’s no good reason to validate before save, is there? Using @IsDocBeingSaved will keep validations from firing when the document is merely being refreshed.

Subject: RE: Input Validation & Strange Behavior

Hello Stan… I agree 100%. I thought input validation happened after input translation and ONLY after a save. I just cannot understand why having a validation formula would cause an error/validation right after the new document is created. I’m going to use your @Is… formula and try it again. Will post in a sec…

Update: I added the @IsDocBeingSaved to the formula -w- the same results. The minute I create a new doc and click on the form, it throws the validation dialog. Here is the updated validation formula… anything wrong with it?

@If(@IsDocBeingSaved & NoContactReason=“Not Applicable” & CallCustomer=“” | CustomerProds=“”;@Failure(“Missing Data - Please Check Required Fields”);@Success)

Subject: RE: Input Validation & Strange Behavior

@If(@IsDocBeingSaved & NoContactReason=“Not Applicable” & CallCustomer=“” | CustomerProds=“”;@Failure(“Missing Data - Please Check Required Fields”);@Success)
You must use parenthesis to group your logical expression. The one you’re using now returns True whenever CustomerProds = “”, regardless of the other terms.

You’re correct that input validations normally do not fire when composing a document. This, together with the second message you’re getting, means there’s some LotusScript code – perhaps in the CreateDoc button, perhaps in the Postopen event, maybe somewhere else – that’s refreshing the document right after its opened.

Please make a nicer validation message telling what the exact problem is!

Subject: RE: Input Validation & Strange Behavior

Thanks Andre… I tried to add () around the OR fields. See below…

@If(@IsDocBeingSaved & NoContactReason=“Not Applicable” & (CallCustomer=“” | CustomerProds=“”);@Failure(“Missing Data - Please Check Required Fields”);@Success)

If the NoContactReason = “Not Applicable” and any of the following fields is blank (CallCustomer and CustomerProds) then fail with the message. The last 2 fields should not be blank (when doc is saved) if the 1st = “Not Applicable.” If it has any other value (is a dialog list), it is OK for these fields to be blank. I hope this helps… sounds like my () are off. Thanks all…

Subject: RE: Input Validation & Strange Behavior

I created a new form (1 field) and added input validation. It worked… created doc, entered cursor in field w/o prompt, etc. It works as expected. Back to the real form… I tried to trim the validation down to @If(field=“”;@Failure(“Message”);@Success). I attempted to create the doc and the same thing happens!?! …even tried re-creating the fields. If I create a new doc and click once inside the document (no matter field), it pops up the message. Next step… am deleting the form in the database (am using template) and will try replacing entire form. This does not make sense… proved with the test form that it works.

Subject: RE: Input Validation & Strange Behavior

If you are now using this formula:

@If(@IsDocBeingSaved & NoContactReason=“Not Applicable” & (CallCustomer=“” | CustomerProds=“”);@Failure(“Missing Data - Please Check Required Fields”);@Success)

then the validation is fine. It’s doing exactly what it should (based on your description).

If you use this formula and still have the same error messages as before, then the problem is caused by some LotusScript code (probably in the button you use to create the document, but maybe on the form) which is composing the document and immediately trying to save it, without having filled in the fields. Guess what! Your validation formula very correctly prevents it from saving the document with illegal data.

Subject: RE: Input Validation & Strange Behavior

Thanks Andre… even tried the most basic of validation like @If(field=“”;@Failure(“message”);@Success) and it still happens. The “Create Doc” button is a simple @Command([Compose];“Report”). There are only a few fields… will check them again. The strangest field on the form (only 8 fields) is a dialog list that uses a view for dialog choices.

Subject: RE: Input Validation & Strange Behavior

Michael, e-mail this app to me and I’ll look it over and see what I can see. Unless you’ve found the culprit already, that is.

Subject: RE: Input Validation & Strange Behavior

Joel… thanks for the offer. How have you been? I hope well. Strange… rebuilt the form and included the @IsDocBeingSaved and all is fine now. I know this was included before… works now. There were no hidden scripts, etc. It was simple… 8 fields with he most complicated being a dialog list (using views for choices).

Subject: RE: Input Validation & Strange Behavior

Things are going ok… looking for work mostly. Cleaning up after the storm… not much else. As long as it works now, that’s what matters.

Subject: RE: Input Validation & Strange Behavior

JAX was getting battered. All OK now? I have been trying to reach some friends via email (in St. Augustine, etc.). Just sent you an email.