lengleng Posted July 13, 2021 Report Share Posted July 13, 2021 Hi, I'm testing a workflow where I'm redirecting a user if the Authentication Fails. It seems that Failure message does not work with scripts, and I'm trying out on the Footer. I can see that this element shows up whenever the error appears I don't know how to implement this with the script, though, are there any ideas? Quote Link to comment Share on other sites More sharing options...
TellMeWhy Posted July 13, 2021 Report Share Posted July 13, 2021 Just now, lengleng said: Hi, I'm testing a workflow where I'm redirecting a user if the Authentication Fails. It seems that Failure message does not work with scripts, and I'm trying out on the Footer. I can see that this element shows up whenever the error appears I don't know how to implement this with the script, though, are there any ideas? Yeah, you actually can, but, I found that it's better to create your own element with a unique ID so you can reference the ID instead of the class I have then added an HTML Block in the authentication fields, and NOT the footer because footer and header code gets removed when the Failure Message appears, apparently. <script type="text/javascript"> document.addEventListener("DataPageReady", function tester(){ if(document.getElementById("errormessage")){ window.location.href = "https://www.google.com"; } }); </script> lengleng 1 Quote Link to comment Share on other sites More sharing options...
lengleng Posted July 13, 2021 Author Report Share Posted July 13, 2021 Just now, TellMeWhy said: Yeah, you actually can, but, I found that it's better to create your own element with a unique ID so you can reference the ID instead of the class I have then added an HTML Block in the authentication fields, and NOT the footer because footer and header code gets removed when the Failure Message appears, apparently. <script type="text/javascript"> document.addEventListener("DataPageReady", function tester(){ if(document.getElementById("errormessage")){ window.location.href = "https://www.google.com"; } }); </script> Thank! I'll try this, but, what if I use auto submit as well? I'm trying to use HTML to Caspio I'm sorry I forgot to include it in the post. Quote Link to comment Share on other sites More sharing options...
TellMeWhy Posted July 13, 2021 Report Share Posted July 13, 2021 Just now, lengleng said: Thank! I'll try this, but, what if I use auto submit as well? I'm trying to use HTML to Caspio I'm sorry I forgot to include it in the post. It's pretty easy, just add ELSE on the code and use auto submit <script type="text/javascript"> document.addEventListener("DataPageReady", function tester(){ if(document.getElementById("errormessage")){ window.location.href = "https://www.google.com"; } else{ setTimeout('document.forms["caspioform"].submit()',1000); } }); </script> In my code I removed the display none, but, you can include that since you wouldn't want your users to be seeing that anyway, you can also reduce the 1000 delay to a faster one, but I think that's fast enough and if you have display none, it will be alright. lengleng 1 Quote Link to comment Share on other sites More sharing options...
lengleng Posted July 13, 2021 Author Report Share Posted July 13, 2021 5 minutes ago, TellMeWhy said: It's pretty easy, just add ELSE on the code and use auto submit <script type="text/javascript"> document.addEventListener("DataPageReady", function tester(){ if(document.getElementById("errormessage")){ window.location.href = "https://www.google.com"; } else{ setTimeout('document.forms["caspioform"].submit()',1000); } }); </script> In my code I removed the display none, but, you can include that since you wouldn't want your users to be seeing that anyway, you can also reduce the 1000 delay to a faster one, but I think that's fast enough and if you have display none, it will be alright. Wow!! Thank you so much!! I'll try this out, I wasn't really keen on implementing this feature, but, since there is a solution, I'll do it now :D Quote Link to comment Share on other sites More sharing options...
Kronos Posted October 20, 2023 Report Share Posted October 20, 2023 Hi, if you want to redirect users if they are using mobile or desktop you may try this solution: I hope this helps! 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.