Blocking the Do you want to save your changes prompt

On a "submit" button action, I change the value of a field just before doing a @Command([FileSave]);

But the alert Do you want to save your changes? always prompt...

Is there a way to block this?  Is there also a way to block people quitting your form with the tab, and so, force them to use the action buttons?

I know it could looks like 2 questions, but in fact, I only want to know if we can manage, overpass or block the Lotus prompts and alerts...
barbotteAsked:
Who is Participating?
 
RanjeetRainConnect With a Mentor Commented:
SaveOptions should be a "Computed for Display" field of TEXT type.

Also, modify your code like this:



FIELD LeStatus := LeStatus;
FIELD SaveOptions := SaveOptions;


@If(LeStatus = "Initial" ; @SetField("LeStatus"; "Assigned"; "");
@SetField("SaveOptions"; "1");
@Command([FileSave]);
@Command([FileCloseWindow]);


Check for the syntaxes. I might have left a typo.
0
 
RanjeetRainCommented:
Add a "Computed for display" field to your form and specify its default value as "1". This iwll not happen.
0
 
RanjeetRainCommented:
>> Is there also a way to block people quitting your form with the tab, and so, force them to use the action buttons?

I am not sure what you mean by TAB. If you mean you wanna prevent users from switching windows when he/she is editing document, it will not be easy. The solution lies in the NotesUIWorkspace.DialogBox. See this example from Designer Help:

Sub Click(Source As Button)
  Dim workspace As New NotesUIWorkspace
  Call workspace.DialogBox ( "policy", True, True, True, True, False, False, "Policy" )
End Sub

You can do something sminilar to get it to work.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
barbotteAuthor Commented:
I already have a Computed for display field, which I gave a default value

??
0
 
RanjeetRainCommented:
>> Add a "Computed for display" field to your form and specify its default value as "1". This iwll not happen.

Correction!

Add a "Computed for display" field named "SaveOptions" to your form and specify its default value as "1". The presence of this field makes Domino silently save the document while closing, if modified.

If you wanna discard changes while saving, specify its default value as "0".
0
 
RanjeetRainCommented:
>> If you wanna discard changes while saving, specify its default value as "0".

If you wanna discard changes while CLOSING, specify its default value as "0" :)
0
 
barbotteAuthor Commented:
Still prompting the Save dialog box with a Computed for Display field named SaveOptions

Does the type is Text?  I guess...  Do the name of the field start with a dollar sign ??
0
 
barbotteAuthor Commented:
Here's the exact code I've got on the action button:

@If(LeStatus = "Initial" ; FIELD LeStatus := "Assigned" ; FIELD LeStatus := LeStatus);
@Command([FileSave]);
@Command([FileCloseWindow])
0
 
barbotteAuthor Commented:
Is there missing a right parenthesis somewhere?  And an error tells me the @If takes "an odd number of arguments"
0
 
barbotteAuthor Commented:
I really tried working out with the parenthesis and the empty "" but it still do not work!

I got this, added a parenthesis after "Assigned":

FIELD LeStatus := LeStatus;
FIELD SaveOptions := SaveOptions;

@If(LeStatus = "Initial" ; @SetField("LeStatus"; "Assigned"); "");
@SetField("SaveOptions"; "1");
@Command([FileSave]);
@Command([FileCloseWindow]);
0
 
barbotteAuthor Commented:
increasing Point Value of the question!
0
 
RanjeetRainCommented:
FIELD LeStatus := LeStatus;
FIELD SaveOptions := SaveOptions;

@SetField("LeStatus"; @If(LeStatus = "Initial" ; "Assigned"; LeStatus));
@SetField("SaveOptions"; "1");
@Command([FileSave]);
@Command([FileCloseWindow]);
0
 
madheeswarCommented:
taking from RR,
maqke it like this:

FIELD LeStatus := LeStatus;
FIELD SaveOptions := SaveOptions;
@SetField("LeStatus"; @If(LeStatus = "Initial" ; "Assigned"; LeStatus));
@SetField("SaveOptions"; "1");
@Command([FileSave]);
@PostedCommand([FileCloseWindow])
0
 
RanjeetRainCommented:
Hi Mady... hows it going!
0
 
barbotteAuthor Commented:
Still do not work...  Plus it creates another bug:

Before, on a completely different button of the same form, I was changing the value to something else...  THis other button (a kind of Send button)

@SetField("LeStatus"; "Sent");
@Command( [FileSave] );
@Command([FileCloseWindow])

But now, this button do not works anymore, and I see the value change for hafl a second, and it comes back to the old value again, and the Save system prompt appears...

???
0
 
barbotteAuthor Commented:
Well, forget the bug about the other button, it's because the Status field must be Editable.  If it's Computed in anyway, the value won't change...

But still, the Save system prompt always appears...
0
 
RanjeetRainCommented:
YOu would be better sorting out your problems one-by-one than all at once. For one momnet, leave out your other fields and then test it. If it works you can convert back. Checklist:

1. Do you have a SaveOptions field?
2. Make its type 'Editable'.
3. Is the data type of the field 'TEXT'?
4. Is the default value "1"? (With quotes, so that it is a TEXT value, witout quotes it is a numeric value)
5. Make sure that you do not have any LotusScript code in your QuerySave, PostSave events.

Now try closing the form. Does it still prompt you to save?
0
 
barbotteAuthor Commented:
Checklist followed.

If I do not modify the form (don't enter any data) it sure do not prompt me to save changes.  But if I make a change (enter some data in only 1 field) then yes, it still prompt me Do you want to save...
0
 
barbotteAuthor Commented:
Increasing again Point Value to 120!

I notice that If I remove the @Command( [FileCloseWindow] ); the prompt does not appear, but the window don't close, of course!  But the change of value happens without system prompt...
0
 
qwaleteeCommented:
suspect you are going about this the wrong way.  I don't want to know the keystrokes, etc. you are trying to make happen.  I want to know, what is the purpose of doing all this?  If I understood your app better, I could probably tell you exactly what to do.  The SaveOption business is a workaround, it sounds like you really wnat the doc to save and the window to clos eimmediately using your button.  Perhaps you have a PostRecalc event with code in it?
0
 
barbotteAuthor Commented:
The thing is that I've got a Status field wich change automatically (but NOT manually) according to the data entered in other fields.

Example: by default, the status field is "incomplete"... The person can change the document in anyway he wants and save it, the status will remain "incomplete".  Only when he Sends the document, the status change to "initial"...

Then, another person receives it, and enter some more data, so the status changes to "assigned"...

So when I load the document, I've put a default value to "incomplete"...

Then on the SAVE button, but only AFTER the document was Sent, I check if some fields are filled.  If they are, then the status change to "assigned", if they're empty, then the status is still "initial", which mean the document was sent, but not seen by the 2nd person...

But the only thing I want, is to stop the system alertbox saying Do you want to save your changes?

This system alert seems to pop out only when I try to close the document, even if there is an @command([FIleSave]) just the line before!
0
 
barbotteAuthor Commented:
The only thing changing in the document is the Title, depending if it's a newdoc or and old one.

No other scripts or formulas are in the form itself, only on the action buttons or on the fields.
0
 
barbotteAuthor Commented:
Though one, isn't it?
0
 
qwaleteeCommented:
Do you have it set to automatically refresh fields?

FOr the thing you are doing, you really ought to just use Refresh Fields On Keyword Change, which would prevent the whole problem.
0
 
barbotteAuthor Commented:
In my form properties, I only have the "render pass through HTML" checked, no other option are checked.

Where's the option with "...on keyword change"??

The only option about refreshing is "Automatically refresh fields", which is not checked.

Should I check it?
0
 
madheeswarCommented:
Enable :Automatically refresh fields in form properties box and try.
0
 
barbotteAuthor Commented:
Do not work...

increasing again question by 30 point to reach 150
0
 
madheeswarCommented:
Can u post ur mail send code and where it is coded? is it formula or Script doing in QuerySave?
 
Let me explain what u have to do.
Try to create a new database and a form in it.

Create a SaveOptions field. Editable and text. Default is "0".
Create LeStatusm field and make default value "Initial"
Compose this form and Click on the button which had the below formula:
FIELD LeStatus := LeStatus;
FIELD SaveOptions := SaveOptions;
@SetField("LeStatus"; @If(LeStatus = "Initial" ; "Assigned"; LeStatus));
@SetField("SaveOptions"; "1");
@Command([FileSave]);
@PostedCommand([FileCloseWindow])

it should not prompt for savedialog and once the doc is saved and closed, check the field value LeSATATUS. it should have "Assigned" as the value.

Once the above test is completed, let us know the result.
thanks.
0
 
barbotteAuthor Commented:
madheeswar, I've put your formula in the Formula zone of the Action button...

Bug still appear...
0
 
barbotteAuthor Commented:
well, here's the solution:

@If(@PostedCommand([FileSave]); @PostedCommand([FileCloseWindow]); "")

This doesn't make the Save confirmation popup appear.

But this do:

@Command([FileSave]);
@PostedCommand([FileCloseWindow])

I'll give the points to RanjeetRain as it's the first who pointed out the SaveOptions field thing, which helped me solve the problem...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.