logo

New Response

« Return to the main article

You are replying to:

  1. Not sure if this is related to your quandry about using the "FileCloseWindow" command for the Web but I have found very useful information in your site so I hope to give a little back.... :-)

    I provide an action button to logically "close" the document when opened in a Web browser that is based on whether the document is in Read or Edit mode.

    When in (Web) Read mode there is a "Go Back" action:

    // Shared Action: Go Back // Hide: Notes, Edit // Note: Use only for forms - for Web interface // Note: Use Cancel for Edit mode

    history.back()

    =====

    When in (Web) Edit mode there are two buttons, one to "Save & Close" and one to "Cancel":

    // Shared Action: Save & Close // Hide: Notes, Read // Note: Use only for forms - for Web interface

    // Only submit the document if all the fields validated correctly if (validateFormFields()) { thisform.submit(); }

    =====

    // Shared Action: Cancel // Hide: Notes, Read // Note: Use only for forms - for Web interface // Note: Use Go Back for Read mode

    // When a Domino Web page is reloaded, such as by a refresh fields or by selecting a tab on a // tabbed table, the page is reloaded with the same URL, but now with "&Seq=n" appended, // where "n" is the value indicating the number of times the page has been reloaded. // We want to return to the page that was loaded before the current page, no matter how many // times the current page has been reloaded.

    var strCurURL = document.location.href; var index = -1; var nSeqNum = 0; var nSeqPos = strCurURL.indexOf("&Seq=");

    if ( nSeqPos != -1 ) { nSeqNum = strCurURL.substring(nSeqPos + 5, nSeqPos + 8); var nEndPos = nSeqNum.indexOf("#"); if (nEndPos != -1) { nSeqNum = nSeqNum.substring(0, nEndPos); } nEndPos = nSeqNum.indexOf("&"); if (nEndPos != -1) { nSeqNum = nSeqNum.substring(0, nEndPos); } index = index - nSeqNum; } // Ensure there are enough history pages to go back to if ( 0 - history.length > index) { history.back(); // Not enough history, so just go back 1 page } else { history.go(index); }

    =====

    Notes:

    There is no code in the "onSubmit" event for the form.

    There is a "validateFormFields" JS function defined in the "JS Header" for the form. This function does all the field validation and returns either false or true.

    There are also "Close", "Save & Close", and "Cancel" action buttons on the form for when the document is displayed in a Notes client.

    =====

    REM "Shared Action: Close"; REM " Hide: Web, Preview, Edit"; REM " Note: Only shown in Action button bar"; REM " Note: Use Cancel for Edit mode";

    @Command([FileCloseWindow])

    =====

    REM "Shared Action: Save & Close"; REM " Hide: Web, Read"; REM " Note: Use only for forms - for Notes interface";

    REM " Note: Cannot use @IsValid on the Web";

    REM "Only save the document if all the fields validated correctly"; @If(@IsValid; @Do(@Command([FileSave]); @Command([FileCloseWindow])); "")

    =====

    REM "Shared Action: Cancel"; REM " Hide: Web, Read"; REM " Note: Use only for forms - for Notes interface"; REM " Note: Use Close for Read mode";

    FIELD SaveOptions := 0; @Command([FileCloseWindow])

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: