Complex validations and the order of operations

This is a rather complicated question - but I will give it my CRISPY best:

A form has lots of fields - (version 4.x vintage) - and many of them have input validation. eg:

@if(field = “”; @failure(“…”); @success)

A couple “comments” fields works as follows:

Every time a the form is saved:

A comment-history field collects whatever the comments-input field has in it for a permament record. Then,

an input translation formula, in the actual comments-input field clears it: @If(@isdocbeingsaved; “”; comments)

The comments fields (input and history) are all at the bottom of them form. The other validated fields are above them.

Problem:

If someone saves the document, and a field with a validation fails, the comment is still commiting to the history field. When that happens, the user then has to put in another comment!

You can imagine the issue if 2 or 3 validations fails consecutively.

My question is:

What is the order of operations here?

The behavior here tells me that first the computed fields ran, then all input translations run - then finally all the validations run.

Can anyone confirm this order? I would appreciate any advice.

TIA

Subject: complex validations and the order of operations

Hi!

Have a look at @isvalid for your comment fields. The better way is to use script. There you can validate all fields and if they’re all ok you write your comments.

Stefan

Subject: Agreed!

Stefan, I agree. Had I coded this (initially) I avoid input validations in favor of something like an all-inclusive QuerySave event or computed field. But this is just to re-work an existing application. I don’t have the resource to re-code at this point.

I will take a look at @IsValid. Thanks for the advice on that.

Subject: complex validations and the order of operations

There’s a field option for computed fields to compute after validation; it’s intended for situations like yours.