Jump to content

2 Functions of Submit button


Recommended Posts

  • 2 weeks later...

Hi NeoJS,

To log out the DataPage automatically upon submission, please do the following:

  1. Create a Header and Footer on your DataPage, if you have not done so.
  2. Then, put the code shown below inside the footer. Please make sure that the Source button in the editor is enabled.
<script type="text/javascript">
    // Form submission status
    var formSubmitted = false;

    // TODO: Put your actual logout URL here -->
    var logoutUrl = "https://YOUR_CASPIO_SITE/folderlogout";

    // TODO: Put your desired check-up duration here (in secs.) -->
    var timeOutSecs  = 1;
    var timeOutMsec  = timeOutSecs * 1000;

    var confirmationMessage = document.getElementsByClassName("cbConfirmationMessages")[0];
    if (confirmationMessage)
    {
       formSubmitted = true;
    }

    // Regularly checks if the form has been submitted
    setInterval(
        function()
        {
            /**
             * NOTE:
             *     It only gets executed if the form has
             *     been submitted successfully. If not,
             *     the user will see the form again, with
             *     the required fields highlighted.
             */
            if (formSubmitted)
            {
                alert("This page will log out automatically after " + timeOutSecs + " sec(s).");
                window.location.href = logoutUrl;
                return false;
            }
        },
        timeOutMsec
    );
</script>

 

Quote

NOTE: This solution is only applicable on submission DataPages whose Destination Page is set to Display a Message. System limitations prevent us from applying an auto-logout behavior on DataPages which redirect to a new page or a new DataPage.

 
1

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...