Solved

Input Validation - how to stop Save & Close action when verification done in QuerySave?

Posted on 2006-07-17
8
1,810 Views
Last Modified: 2013-12-18
Hi Experts!

I was doing my field verification under each field - and had a Save & Close action with the following formula:
@If(!@IsValid;@Return("");@Success);
@Command([FileSave]);
@Command([CloseWindow])

Now I have moved my field verification to Lotus Script in the QuerySave of the form ( so it is all in the one area and it is now conditional on other fields ).

BUT ;)  now when I choose Save & Close the QuerySave runs -- telling me what fields I am missing and the document is closed by the action - not allowing the user to fill in these required fields.

Here is the validation in Lotus Script QuerySave event:
            Elseif doc.LeWrapUp(0) = "" Then
                  Messagebox("Please enter WrapUp code." )

I could make seperate "Save"   and   "Close"  buttons - but surely there is a better way??  How can I stop the action if the LS requirements are not met?  Thanks for your help,
Broad.
0
Comment
Question by:BroadAustralia
  • 4
  • 3
8 Comments
 
LVL 18

Expert Comment

by:marilyng
ID: 17127065
Ok, I assume you've taken the field validation out of the fields?  

In the querysave event, you have the continue = false.

But when you press the action button, guess what, the actions run faster than the querysave values.

So, usually in your action button:
 
if you have field validation events:
@if(!@isValid;@Return("");"");
@if(@command([FileSave]);@Do(
  @SetField("Whatever";"ThisValue");
  @PostedCommand([FileCloseWindow])); "")

Sometimes you also have to check if the document has been deleted, too. :)

If you don't have field validations, you can just do the:
@if(@command([FileSave]);@Do(
  @SetField("Whatever";"ThisValue");
  @PostedCommand([FileCloseWindow])); "")

----------
Now normally, when you  start all this the other little irratating dialog box gets in the way, too.  "Do you want to save your changes?"  And if you say, no, it keeps popping up.  So, now you have to trap the SaveOptions in the events.

By placing a field called: "SaveOptions" on the form, editable, default value = "1"  which means to prompt to save if changes are made.

So, now you have th wonderful task of deciding when the user SHOULD be prompted if he or she wants to save the document when they press the ESC key, or if they press CLOSE.

        Usually you set the SAVEOPTIONs in POSTOPEN (if the document is being edited)
        POSTMODECHANGE (if the document is being edited)
        QUERYSAVE (To allow the changes to be saved to the document, and then to reset the value to "0" so users don't get the "do you want to save" dialog box)

       And in the Save and Close action buttons:

  @if(!@isValid;@Return("");"");
  @SetField("SaveOptions";"1");

@if(@command([FileSave]);@Do(
  @SetField("Whatever";"ThisValue");
  @SetField("SaveOptions";"0");
  @PostedCommand([FileCloseWindow])); "")

Hope this wasn't too confusing.. and sorry I jumped ahead to the next question.



0
 
LVL 18

Expert Comment

by:marilyng
ID: 17132070
0
 
LVL 1

Author Comment

by:BroadAustralia
ID: 17134085
Hi Marliyn

Thanks for the link I will look at the tools.

I need some help with this though sorry I am not getting it   &(   I also have to take it one step of the time I hope it's not to painfull ;)

If I use this formula below in the Save & Close action, the document IS NOT closed ( great ) and then user can then fill out the required field.  But if they don't, or if there is more than 1 field that is required I end up again with the same problem yes??  ( I am missing something? ).  I think so.

@if(!@isValid;@Return("");"");
@if(@command([FileSave]);@Do(
  @SetField("Whatever";"ThisValue");
  @PostedCommand([FileCloseWindow])); "")

Thanks for your paitence

Broad.

0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 18

Accepted Solution

by:
marilyng earned 500 total points
ID: 17135131
Kinda.. if your query save does the loops...

So, when you press the action button,
     - it checks to see if there are any field validation events.
     - if it finds any, it stops the processing and does not save, does not close.  User has to fix the
       invalid fields and press the save button again.

-If it passes isvalid, then it moves to the FileSave.  
-If you don't preface this with the "@if" statement  then the filesave happens and moves on to FileCloseWindow before your QuerySAve event processes.

-With the "@if" statement, the querysave event processes.
-In this, I assume you have a list of fields that you want to test,

example:

Sub querySave( source as NotesUIdocument, continue as variant)
     continue = false
     dim chkFieldList as variant
     Dim doc as notesdocument
     set doc = source.document
     ChkFieldList = doc.ChkFieldList
    forall chk in chkfieldList
     if len(doc.getItemValue(chk)(0))<1 then
        'field fails  continue is already false
        exit sub  
    end if
   end forall

'if you get here then
    continue = True
end sub

The querySave exits when the selected fields pass validation, and allow the action button to proceed to the FileCloseWindow.  

However, because you have not addressed saveOptions, the front end save will prompt the "do you want to save" message as soon as you call the "FileCloseWindow"

Does that help any?
0
 
LVL 18

Expert Comment

by:marilyng
ID: 17211739
How are you doing with this?
0
 
LVL 1

Author Comment

by:BroadAustralia
ID: 17285470
Hi Marlilyn,

Sorry I missed your follow up on the 31st  "thankyou".  When I couldn't resolve after your 1st post I had to get "something" working as the system was live and I was getting documents with essential missing fields...  ( I just put two seperate buttons  "Save"    and a "Close")     In the mean time I've been dealing with all other sorts of fun things that us lucky IT people get to do ;)

Things like dealing with telecomms providers, backup problems, and other exciting projects too many to list here!!

I am back onto this now ( well, tomorrow now, I guess ) and thanks so much for explaining.  Thanks for your help,

And if I forgot to mention it, thanks ;)

Broad.
0
 
LVL 1

Author Comment

by:BroadAustralia
ID: 17314530
Hi Marliyn

Thanks for sharing your knowledge.  Sorry we had some public holidays here & I needed the time off!

Broad
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now