Link to home
Start Free TrialLog in
Avatar of brianbailey
brianbailey

asked on

Save as Open, Save as Closed, and Cancel buttons...probably an easy one

I want to create 3 buttons on my form: Save as Open, Save as Closed, and Cancel.  Each will do the following:

Save as Open: save the current form with STATUS field indicating "Open"
Save as Closed: save the current form with STATUS field indicating "Closed"
Cancel: close the document and discarding any changes made

There are two buttons at the top of my form currently (not exactly sure how they got there, but I must have added them somehow), both are (Untitled)(Action)s.  Would love to add a third and have them do what is indicated above.

Like I said...this is probably pretty easy.  
Avatar of p_partha
p_partha



Code in the buttons:

Save as open


Field status:="Open";
@command([filesave]);


Save as closed

Field status:="Closed";
@command([filesave]);

cancel
@command([fileclosewindow])


To create this button, go to the form. IN the create menu --> action.. You can give the names and paste the formula given above


partha
Avatar of brianbailey

ASKER

Okay...they change the field, but the document does not close on either status changes.  The Cancel function brings up the dialog as to whether or not I want to save changes.  I don't want this dialog to come up if possible.  I would like each of these three to bypass this by saving changes for the first two, and cancelling for the third.
SOLUTION
Avatar of p_partha
p_partha

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
OKay...the cancel works great.

As far as the Save Open and Save Closed buttons, is there any way to avoid the "Do you want to save" dialog that comes up?  I want to bypass this so it automatically saves (since that is what the button is).
why do u need to do it at the form level. You can do it at the view level. Select the document and change its value by having the action button in the view level.


Have a action button in view and jsut have this formula:

field status:="Open";@true

Hope this helps

Partha
Are you saying that Parha's code:

Field status:="Open";
@command([filesave]);
@command([fileclosewindow])

...results in a prompt to save?!
Yes.  It asks me if I want to save my changes? Yes, No, Cancel.
That;s why i asked u to do it at the view level. It somehow always prompts the save..Seems to be bug with Lotus

Partha
ASKER CERTIFIED SOLUTION
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
OKay...it works.  Just one last thing.  What can I add to those that would also at the same time open the document for editing.  If I am viewing the document, the buttons appear.  Sometimes it is just about changing "status".  Can I add something to the beginning of the first two that will open the doc for editing?  If I push the botton when I am just viewing it, it closes it but doesn't edit it.
Why don't u show the buttons only to a subset of people , who are supposed to do this tweaking work of changing status. Have a hidewhen formula for this button and show only to users who satisfy that criteria.

For ex: have a role by name Admin in the database and have the hidewhen like this
@IsNotMember("[Admin]"; @UserRoles) for the buttons

Hope i am clear

Partha
Let me restate what I was saying.

The buttons currently only work if the document is opened for editing.  I would like them to open the document for editing if it isn't already open.
@Command([EditDocument]);
FIELD status:="Opes";
@Command([FileSave]);
FIELD saveoptions:="0";
@Command([FileCloseWindow])

Have something like this. By this u are sure that the document is edited


Partha
No no no no!!!

@Command([EditDocument]); will place it into edit mode if in read mode... but it will also change it to read mode if it is already in edit mode!


Use:
@Command([EditDocument]; "1");
FIELD status:="Opes";
@Command([FileSave]);
FIELD saveoptions:="0";
@Command([FileCloseWindow])


Adding the "1" to [EditDocument] forces to always end up in EditMode -- switching from read mode, or leaving alone if already in edit.
Qwalette,
Although i didn't specify it as perfectly as ur's i meant only that...

Partha