Nice article, and as usual, I wish you had kicked this out a couple of months
earlier, when I struggled on with my own version after finding nothing sensible
'out-there' for server validation!
Anyway, just a couple of thoughts...
I build my formula error-checks in a computed multi-value field, say: errorChk
like:
@trim(
@(Name=""; "No Name"; "") : @if(Tel=""; "No Tel"; "")
)
The end result is a either a null (no errors) or a list of error strings. Then
simply check the field for null or otherwise:
@If(ErrorChk = ""; @doThis; @doThat)
Its easier and more elegant than setting/clearing the field and the boolean
test is easy too! (whats all this @elements>0 stuff eh?).
When calling a WQS Agent, the computed error-message list is easy to access:
if thisdoc.ErrorChk(0) = "" then...
Its even possible to send an LS error-list back to the reopened document so
that the user is shown a list of on-doc and wqs-agent generated messages 'in
context'
Anyway, missed the 'save only' trick on the submit!
Now, couple of queries:
1. I have experienced issues where a save only triggers a WQS event - so the
agent runs, if its not a save/close event!! Any work arounds?
2. When writing 'public' docs with user=reader acl access, you can create docs,
edit them, but not save them (!) if saveoptions=1 - which is a pain! So how
recover if saveoptions=0 and want to get the data back in the form? when its
reopened? (okay - I think - if use author with create rights!)
Nice article, and as usual, I wish you had kicked this out a couple of months earlier, when I struggled on with my own version after finding nothing sensible 'out-there' for server validation!
Anyway, just a couple of thoughts...
I build my formula error-checks in a computed multi-value field, say: errorChk like:
@trim( @(Name=""; "No Name"; "") : @if(Tel=""; "No Tel"; "") )
The end result is a either a null (no errors) or a list of error strings. Then simply check the field for null or otherwise:
@If(ErrorChk = ""; @doThis; @doThat)
Its easier and more elegant than setting/clearing the field and the boolean test is easy too! (whats all this @elements>0 stuff eh?).
When calling a WQS Agent, the computed error-message list is easy to access:
if thisdoc.ErrorChk(0) = "" then...
Its even possible to send an LS error-list back to the reopened document so that the user is shown a list of on-doc and wqs-agent generated messages 'in context'
Anyway, missed the 'save only' trick on the submit!
Now, couple of queries:
1. I have experienced issues where a save only triggers a WQS event - so the agent runs, if its not a save/close event!! Any work arounds?
2. When writing 'public' docs with user=reader acl access, you can create docs, edit them, but not save them (!) if saveoptions=1 - which is a pain! So how recover if saveoptions=0 and want to get the data back in the form? when its reopened? (okay - I think - if use author with create rights!)
any help appreciated - chrz +T+