Problem solve Get help with specific problems with your technologies, process and projects.

Prompt user save before clicking another link

I have navigator in the left frame and forms or views in the right frame. If a user is editing a document in the right frame and then they click the link in the left navigator without saving the document, they lose their data. How can I prompt the user to save the document before they can click on the other link, after they edited the document?
Here's a simple description for a solution that will work:
  1. Create a hidden, but editable, field that can be used as a flag. Default the field value to "NotSaved."

  2. Set the "Edit" action on the form to ensure that the flag is set to "NotSaved" so that it will also be set whenever a document is put in edit mode. Here is sample formula action code:
    FIELD Flag := "NotSaved";

  3. Set the "Submit" or "Save" action to modify the flag field to something else before submitting the form. Here is sample JavaScript to do the trick:
    document.forms[0].Flag.value = "Saved";

  4. Put some JavaScript code in the form's onUnload event to catch when the user navigates away from the form:
    if (document.forms[0].
    Flag.value == "NotSaved")
     if (confirm ("Your changes have not
     been saved. Do you want to go back to the 
      // go back to the form 

This is a simplistic solution, but you should be able to customize it to meet your needs.

Do you have comments on this Ask the Expert question and response? Let us know.

Dig Deeper on Lotus Domino Designer

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...