NeoInJS Posted August 18, 2016 Report Share Posted August 18, 2016 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? Quote Link to comment Share on other sites More sharing options...
JayMont Posted August 18, 2016 Report Share Posted August 18, 2016 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. Quote Link to comment Share on other sites More sharing options...
nightowl Posted August 26, 2016 Report Share Posted August 26, 2016 Hi NeoJS, To log out the DataPage automatically upon submission, please do the following: Create a Header and Footer on your DataPage, if you have not done so. 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.