Solved

Form Closing without saving or prompting

Posted on 2004-08-16
23
296 Views
Last Modified: 2013-12-18
Hello all,
I have a unique situation going on.  I have a large form, therefore I do not use auto refresh fields in order to maintain performance.
I have 2 fields that I have setup as required fields using failure, success @ command.  When I create a document with the form and hit save without filling in those fields, the form prompts the required field message then I get a notes failed validation message, then the error message again and then the form closes without saving it.
I do have a refresh script in the Querysave of the form, so I can understand the duplicate error message due to a refresh on save and on querysave.  How do I stop the form from closing automatically.??  I removed the Querysave and now I only get the error message once but then the form closes ???
0
Comment
Question by:pratigan
  • 13
  • 6
  • 2
  • +1
23 Comments
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11812836
Do you have a field named "SaveOptions"? If you do, check its value. If its value is set to "0", the form will close without saving, using Formula language you do not have any better control over it.

Yes, what you can do is: create a field names SaveOptions and set its default value as "1" (Text data type). The form shouldn't close.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11814852
Hi RanjeetRain,
> Yes, what you can do is: create a field names SaveOptions and set its default value as "1" (Text data
> type). The form shouldn't close.

No.  When you set SaveOptions to "1" it tells Notes that if the form is closed without saving, then Notes should automatically try to save it just prior to closing.  It does not prevent closing.

Setting the field to zero does indeed allow FileCloseWindow to close without asking to save, even if the doc needs saving.  If you have that, you need to find out why you have it, so that we can incorpoarte both the business need behind its present function AND your technical need to solve this "goodbye" issue.

Cheers!
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11815627
Qwaletee, you are right on that. But, I assumed since he is using @Failure, it should prevent the form from being closed as a end result.

Paul, from my experience, you land up in such situations when you mix LS with FL. I remember being in the same situation when I started with Domino. How I solved it was - by switching to all-LS code.

So, my advice is: Switch to LS completely and then put a Continue = False in your QuerySave.
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 11817574
And all the valiadtions in Lotus Script is the best bet. I also faced same situation and ended up using LS.
0
 
LVL 4

Author Comment

by:pratigan
ID: 11819986
Gentlemen,
That's exactly the situation I'm in.  the logic for the form grows and grows.  I do have a saveoptions field that I added in order to avoid the prompt for save and closure as I have an update status button that approves requests and then sends automated emails.  I didn't want a save prompt to appear.  Just wanted the status to change and send the email and save/close.
I've been thinking of taking the @failure formula out and adding the test in the querysave section with the saveoptions update statement.  I had played with that a bit yesterday but it still closed, I think it was becasue the saveoption statement was in the queryclose section.
I'm going to attempt to move the saveoptions statement to the querysave section along with the continue false if statement.  I'll put all the validation tests in the querysave IF and put the saveoptions statement in the ELSE.
I'll keep you all posted.  I'll be doing this within the next 1/2 hour.
be back soon !!
0
 
LVL 4

Author Comment

by:pratigan
ID: 11820246
my saveoptions field is a computed field that has a formula value of "saveoptions". (Itself)  then the setfield saveoptions to 1 is located in the queryclose event.
I have moved it into the IF statement within the querysave event.  But it's still closing without saving.  I will continue to work with it.  Recommendations please ???
I can convert all formula code to LS but I'd like to get this up and running first due to time considerations.
Thank you !@
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11821042
YOur code block in QuerySave should be something like:

If FormValidationRoutine then
          ... ... ...
          ... ... ...
          ... ... ...
          uiDoc.FieldSetText("SaveOptions", "1")
          uiDoc.Save
          Continue = True
Else
          ... ... ...
          ... ... ...
          ... ... ...
          Continue = False
End If
0
 
LVL 4

Author Comment

by:pratigan
ID: 11821169
This is what I have been currently working with and it's not working.
Sub Querysave(Source As Notesuidocument,  _
Continue As Variant)
      
      If ( source.FieldGetText( "CMcomments" ) = "" ) Then
            Messagebox( "Detailed pkg comments are Required." )
            Call source.GotoField( "CMcomments" )
            continue = False
      Else
            Call source.FieldSetText( "saveoptions", "1" )
      End If
End Sub
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11822602
Is the form getting closed?
0
 
LVL 4

Author Comment

by:pratigan
ID: 11823464
When I test the required field, I get the error message pop up.  I hit the ok button and the form closes instead of puting me in that field to input.  The form is closing without saving.
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11823763
You said the default value of SaveOptions is SaveOptions. Set that to "0" (text data type zero) and test.
0
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!

 
LVL 4

Author Comment

by:pratigan
ID: 11824015
The saveoptions field is a computed field. Do you want me to change it to editable and default to 0.  what will that do to my approval button ??
0
 
LVL 4

Author Comment

by:pratigan
ID: 11824057
I tried.... changed the field to editable.  Default value "0" and retested.  Required message comes up ok, when I click ok the form closes without saving and of course without putting me at that field.
0
 
LVL 19

Accepted Solution

by:
madheeswar earned 125 total points
ID: 11827510
make SaveOptions field default values as "0".

And place the below code in a action button.

dim ws as new notesuiworkspace
dim Source As Notesuidocument
dim curdoc as notesdocument
dim Continue As Variant
set Source=ws.currentdocument
set curdoc=source.document

     If ( curdoc.CMcomments(0) = "" ) Then
          Messagebox( "Detailed pkg comments are Required." )
          Call source.GotoField( "CMcomments" )
          continue = False
end
     Else
          Call source.FieldSetText( "saveoptions", "1" )
call Source.close
     End If
0
 
LVL 4

Author Comment

by:pratigan
ID: 11830434
Hello Mad,
Unfortunately I can't use the logic in a button as there is already a button that prforms approvals.  However, I did place our code in QueryClose instead of querysave and it worked.
Now I need to add more validation fields to it.  This is the tricky part as the number of validation fields are the same field with different numbers and there's alot of them so I need a good way of adding them.  
For example:
If(
(Curdoc.CMel_type1 <> "" And Curdoc.CMplog_X1 = "") Or
(Curdoc.CMel_type2 <> "" And Curdoc.CMplog_X2 = "") Or
(Curdoc.CMel_type3 <> "" And Curdoc.CMplog_X3 = "") Or
(Curdoc.CMel_type4 <> "" And Curdoc.CMplog_X4 = "") Or
(Curdoc.CMel_type5 <> "" And Curdoc.CMplog_X5 = "") Or
(Curdoc.CMel_type6 <> "" And Curdoc.CMplog_X6 = "") Or
(Curdoc.CMel_type7 <> "" And Curdoc.CMplog_X7 = "") Or
(Curdoc.CMel_type8 <> "" And Curdoc.CMplog_X8 = "") Or
(Curdoc.CMel_type9 <> "" And Curdoc.CMplog_X9 = "") Or
 (Curdoc.CMel_type10 <> "" And Curdoc.CMplog_X10 = "") ) Then
This is 1 through 10 I also have 3 more sets of these to add, 1_1, 1_2, 1_3.
Once I add these I'll be in great shape.
Thanks !
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11832512
As a final trial, you can change the default value of "SaveOptions" to "1" and see if that helps. Though i must warn you, this is not a good thing to do. If your users make a change they dont intend to save, their changes may get saved automatically.
0
 
LVL 4

Author Comment

by:pratigan
ID: 11832823
I think I'm alright with it as it is for now, I just need to add the additional fields to the if statement.  I have attempted this and I get somewhat correct, but it doesn't let me out of the error message.  Not sure if the If statement is correct.
0
 
LVL 4

Author Comment

by:pratigan
ID: 11834037
Gentlemen,
Here is my dilema.  I know this is extensive, but the only way I could think to do it.  Please let me know if there is a more clarifying way.  Also it is not saving the document.  I get the error message, correct it. I don't get the next error message if there is to be one and the document closes without saving ?!?!?!?!?!?!
Thanks !

Sub Queryclose(Source As Notesuidocument, Continue As Variant)
      Dim ws As New notesuiworkspace
      Dim curdoc As notesdocument
      Set Source=ws.currentdocument
      Set curdoc=source.document
      
      If ( curdoc.CMcomments(0) = "" ) Then
            Messagebox( "Validation Error - Detailed pkg comments are Required." )
            Call source.GotoField( "CMcomments" )
            continue = False
            End
      Else
            If ((Curdoc.CMel_type1(0) <> "" And Curdoc.CMplog_X1(0) = "") Or  (curdoc.plog_X1(0) <> "" And curdoc.CMplog_CC1(0) = "") Or _
            (Curdoc.CMel_type2(0) <> "" And Curdoc.CMplog_X2(0) = "") Or  (curdoc.plog_X2(0) <> "" And curdoc.CMplog_CC2(0) = "") Or _
            (Curdoc.CMel_type3(0) <> "" And Curdoc.CMplog_X3(0) = "") Or  (curdoc.plog_X3(0) <> "" And curdoc.CMplog_CC3(0) = "") Or _
            (Curdoc.CMel_type4(0) <> "" And Curdoc.CMplog_X4(0) = "") Or  (curdoc.plog_X4(0) <> "" And curdoc.CMplog_CC4(0) = "") Or _
            (Curdoc.CMel_type5(0) <> "" And Curdoc.CMplog_X5(0) = "") Or  (curdoc.plog_X5(0) <> "" And curdoc.CMplog_CC5(0) = "") Or _
            (Curdoc.CMel_type6(0) <> "" And Curdoc.CMplog_X6(0) = "") Or  (curdoc.plog_X6(0) <> "" And curdoc.CMplog_CC6(0) = "") Or _
            (Curdoc.CMel_type7(0) <> "" And Curdoc.CMplog_X7(0) = "") Or  (curdoc.plog_X7(0) <> "" And curdoc.CMplog_CC7(0) = "") Or _
            (Curdoc.CMel_type8(0) <> "" And Curdoc.CMplog_X8(0) = "") Or  (curdoc.plog_X8(0) <> "" And curdoc.CMplog_CC8(0) = "") Or _
            (Curdoc.CMel_type9(0) <> "" And Curdoc.CMplog_X9(0) = "") Or  (curdoc.plog_X9(0) <> "" And curdoc.CMplog_CC9(0) = "") Or _
            (Curdoc.CMel_type10(0) <> "" And Curdoc.CMplog_X10(0) = "") Or (curdoc.plog_X10(0) <> "" And curdoc.CMplog_CC10(0) = "") Or _
            (Curdoc.CMel_type1_1(0) <> "" And Curdoc.CMplog_X1_1(0) = "") Or (curdoc.plog_X1_1(0) <> "" And curdoc.CMplog_CC1_1(0) = "") Or _
            (Curdoc.CMel_type2_1(0) <> "" And Curdoc.CMplog_X2_1  (0) = "") Or (curdoc.plog_X2_1(0) <> "" And curdoc.CMplog_CC2_1(0) = "") Or _
            (Curdoc.CMel_type3_1(0) <> "" And Curdoc.CMplog_X3_1(0) = "") Or  (curdoc.plog_X3_1(0) <> "" And curdoc.CMplog_CC3_1(0) = "") Or _
            (Curdoc.CMel_type4_1(0) <> "" And Curdoc.CMplog_X4_1  (0) = "") Or (curdoc.plog_X4_1(0) <> "" And curdoc.CMplog_CC4_1(0) = "") Or _
            (Curdoc.CMel_type5_1(0) <> "" And Curdoc.CMplog_X5_1(0) = "") Or (curdoc.plog_X5_1(0) <> "" And curdoc.CMplog_CC5_1(0) = "") Or _
            (Curdoc.CMel_type6_1(0) <> "" And Curdoc.CMplog_X6_1  (0) = "") Or (curdoc.plog_X6_1(0) <> "" And curdoc.CMplog_CC6_1(0) = "") Or _
            (Curdoc.CMel_type7_1(0) <> "" And Curdoc.CMplog_X7_1(0) = "") Or  (curdoc.plog_X7_1(0) <> "" And curdoc.CMplog_CC7_1(0) = "") Or _
            (Curdoc.CMel_type8_1  (0) <> "" And Curdoc.CMplog_X8_1  (0) = "") Or (curdoc.plog_X8_1(0) <> "" And curdoc.CMplog_CC8_1(0) = "") Or _
            (Curdoc.CMel_type9_1(0) <> "" And Curdoc.CMplog_X9_1(0) = "") Or  (curdoc.plog_X9_1(0) <> "" And curdoc.CMplog_CC9_1(0) = "") Or _
            (Curdoc.CMel_type10_1(0) <> "" And Curdoc.CMplog_X10_1(0) = "") Or (curdoc.plog_X10_1(0) <> "" And curdoc.CMplog_CC10_1(0) = "") Or _
            (Curdoc.CMel_type1_2(0) <> "" And Curdoc.CMplog_X1_2(0) = "") Or (curdoc.plog_X1_2(0) <> "" And curdoc.CMplog_CC1_2(0) = "") Or _
            (Curdoc.CMel_type2_2  (0) <> "" And Curdoc.CMplog_X2_2  (0) = "") Or (curdoc.plog_X2_2(0) <> "" And curdoc.CMplog_CC2_2(0) = "") Or _
            (Curdoc.CMel_type3_2(0) <> "" And Curdoc.CMplog_X3_2(0) = "") Or  (curdoc.plog_X3_2(0) <> "" And curdoc.CMplog_CC3_2(0) = "") Or _
            (Curdoc.CMel_type4_2  (0) <> "" And Curdoc.CMplog_X4_2  (0) = "") Or (curdoc.plog_X4_2(0) <> "" And curdoc.CMplog_CC4_2(0) = "") Or _
            (Curdoc.CMel_type5_2(0) <> "" And Curdoc.CMplog_X5_2(0) = "") Or (curdoc.plog_X5_2(0) <> "" And curdoc.CMplog_CC5_2(0) = "") Or _
            (Curdoc.CMel_type6_2  (0) <> "" And Curdoc.CMplog_X6_2  (0) = "") Or(curdoc.plog_X6_2(0) <> "" And curdoc.CMplog_CC6_2(0) = "") Or _
            (Curdoc.CMel_type7_2(0) <> "" And Curdoc.CMplog_X7_2(0) = "") Or (curdoc.plog_X7_2(0) <> "" And curdoc.CMplog_CC7_2(0) = "") Or _
            (Curdoc.CMel_type8_2  (0) <> "" And Curdoc.CMplog_X8_2  (0) = "") Or (curdoc.plog_X8_2(0) <> "" And curdoc.CMplog_CC8_2(0) = "") Or _
            (Curdoc.CMel_type9_2(0) <> "" And Curdoc.CMplog_X9_2(0) = "") Or  (curdoc.plog_X9_2(0) <> "" And curdoc.CMplog_CC9_2(0) = "") Or _
            (Curdoc.CMel_type10_2(0) <> "" And Curdoc.CMplog_X10_2(0) = "") Or (curdoc.plog_X10_2(0) <> "" And curdoc.CMplog_CC10_2(0) = "") Or _
            (Curdoc.CMel_type1_3(0) <> "" And Curdoc.CMplog_X1_3(0) = "") Or (curdoc.plog_X1_3(0) <> "" And curdoc.CMplog_CC1_3(0) = "") Or _
            (Curdoc.CMel_type2_3  (0) <> "" And Curdoc.CMplog_X2_3  (0) = "") Or (curdoc.plog_X2_3(0) <> "" And curdoc.CMplog_CC2_3(0) = "") Or _
            (Curdoc.CMel_type3_3(0) <> "" And Curdoc.CMplog_X3_3(0) = "") Or (curdoc.plog_X3_3(0) <> "" And curdoc.CMplog_CC3_3(0) = "") Or _
            (Curdoc.CMel_type4_3  (0) <> "" And Curdoc.CMplog_X4_3  (0) = "") Or (curdoc.plog_X4_3(0) <> "" And curdoc.CMplog_CC4_3(0) = "") Or _
            (Curdoc.CMel_type5_3(0) <> "" And Curdoc.CMplog_X5_3(0) = "") Or (curdoc.plog_X5_3(0) <> "" And curdoc.CMplog_CC5_3(0) = "") Or _
            (Curdoc.CMel_type6_3  (0) <> "" And Curdoc.CMplog_X6_3  (0) = "") Or(curdoc.plog_X6_3(0) <> "" And curdoc.CMplog_CC6_3(0) = "") Or _
            (Curdoc.CMel_type7_3(0) <> "" And Curdoc.CMplog_X7_3(0) = "") Or (curdoc.plog_X7_3(0) <> "" And curdoc.CMplog_CC7_3(0) = "") Or _
            (Curdoc.CMel_type8_3  (0) <> "" And Curdoc.CMplog_X8_3  (0) = "") Or (curdoc.plog_X8_3(0) <> "" And curdoc.CMplog_CC8_3(0) = "") Or _
            (Curdoc.CMel_type9_3(0) <> "" And Curdoc.CMplog_X9_3(0) = "") Or (curdoc.plog_X9_3(0) <> "" And curdoc.CMplog_CC9_3(0) = "") Or _
            (Curdoc.CMel_type10_3(0) <> "" And Curdoc.CMplog_X10_3(0) = "") Or (curdoc.plog_X10_3(0) <> "" And curdoc.CMplog_CC10_3(0) = "") ) Then
                  Messagebox( "Validation Error - Tracking Type and Tracking # are now Required Fields." )
                  Call source.GotoField( "CMplog_X1" )
                  continue = False
                  End      
            Else
                  Call source.FieldSetText( "saveoptions", "1" )
                  Call Source.close
            End If
      End If
End Sub
0
 
LVL 4

Author Comment

by:pratigan
ID: 11851121
I seem to still be having a problem.  I'm gettting trapped in the form.  Even if I try to ESC out, I keep getting the error message.
Not sure why ?????
0
 
LVL 4

Author Comment

by:pratigan
ID: 11851219
This is becoming very agravating.
I'm getting trapped because the required field logic is in QueryClose instead of QuerySave.  However when I put it in Querysave I get the error message and when I hit ok on the error message pop up the form closes without saving .!?!?!?!?!?!?!?1
0
 
LVL 4

Author Comment

by:pratigan
ID: 11851225
If someone would like to check out the entire form, I would be willing to send it to them and double the points.
Thanks !
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11855522
Simplify it!
0
 
LVL 4

Author Comment

by:pratigan
ID: 11870776
I got it working acceptably so I granted points to Madheeswar for the main portion of the changes that was the starting point to getting it to work.
Thank you !
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

10 Experts available now in Live!

Get 1:1 Help Now