Jump to content
NeoInJS

2 Functions of Submit button

Recommended Posts

Hello, is there a way where in the application automatically logs out after the Submit button has been hit, without setting the Destination emails wizard to Go to a new page?

Is there a script I can use to do this?

Share this post


Link to post
Share on other sites

Just to clarify, when the Submit button is clicked, you want the record to submit, then logs-out the user? Where do you want to redirect after log-out?

 

You will need to create a custom submit button if that's the case. Please confirm so we can explore JS options.

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
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...