Link to home
Start Free TrialLog in
Avatar of Zopilote
ZopiloteFlag for United States of America

asked on

Validation and Save button -easy

I have several fields with validation (LN 6) and a button Save.  Once saved I need to send an e-mail message.

How do I stop sending the message if any of the validations failed?

Thanks!!!
ASKER CERTIFIED SOLUTION
Avatar of marilyng
marilyng

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marilyng
marilyng

Ho, ho.. that too!  We need a question listing obvious notes solutions... along with a big hand that reaches out and slaps you a few times because you didn't think of it.
You remember the times there was no QueryRecalc? Another one of those ah-that's-what-it's-for events. Ever used it?
Not yet, but there were a bunch of R5 apps that I could have used this in. :)
I suggested it once on Notes.Net I think. I p-ed me off that I had to do a PostRecalc twice (the second one triggered by a NotesTimer I think) to get a computed list of choices  for a keywords field (set to Refresh choices on form refresh). The choices depended on some other field on the form, and for some reason the thing could only be solved in LotusScript. But PostRecalc is too late, because the keywords field reads the new choices during the recalc. It was making me mad!

Found it, it's one of the earliest references I can find:
    http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/5770b0dde647b4e2852568780036e525?OpenDocument

Hm, this guy had the same problem, months earlier: :-(
    http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/a5d48df9c7523a67852568890034d45d?OpenDocument
Avatar of Zopilote

ASKER

Marilyng, that's perfect! many thanks!  With just @if(!@isValid;@Return("");""); worked perfect.

sjef_bosman, nice suggestion! beautiful and clear! unfortunately it does not work in my case, I have two buttons, one 'Save & e-mail' and another 'Save only', but many thanks indeed!

Oh no! the split did not work the way I wanted!!!
The ACCEPTED ANSWER is MARILYNG and the ASSISTED ANSWER is SJEF_BOSMAN!
I'm surprised you could split with 50 points.. oh, I see you upped it to 75.  I left a message in Community Service. :)  Glad it worked.
Ah, you should have said that you have two buttons! Guessing is not my strongest point ;)

Not for the points, but I'd use a different method: a global variable (in LotusScript) called tobemailed, the Save-button sets tobemailed to False and saves the document, the  Save&Send-button sets tobemailed to True, and the PostSave-event does "if tobemailed then mail the document" and it sets tobemailed to False.
Good thing  Zopilote is not you!    Tell me, do you practice disagreeing?  
I will try again!!
sjef_bosman, interesting suggestion, but I only have one button with the possibility to send the e-mail after saving successfully, therefore IMHO the flag is redundant in my case. Thanks anyway!
Disagreeing? Is that very painful? Then the answer would be no.
Kidding... Zopilote, sjef was offering a second suggestion in case mine was inappropriate for your needs.