After a form is submitted, I'd like to redirect based on a condition. (Running Laserfiche Forms Professional Version 10.4.5.282)
After a form is submitted, I'd like to redirect based on a condition. (Running Laserfiche Forms Professional Version 10.4.5.282)
Okay, in that case, if you have a variable on the initial form that determines that value, then you could do this with JavaScript in the "Thank You" page code that will check the variable and initiate the redirect when the desired value is found.
The important thing to note is that you can only use values present on the submitted form, so if the "remote vs in-person" value is determined after submission, then there's no way to detect it on the thank you page.
For example, in the HTML tab for the "On Event Completion" follow up message, you could add a script tag at the bottom, like this:
<script> $(document).ready(function(){ if(window.top==window.self){ if('{/dataset/Meeting_Type}' == 'In-Person'){ window.location.replace('/Forms/YourForm'); } } }); </script>
NOTE: The if(window.top==window.self) condition is there as a simple way to prevent the code, especially the redirect, from being triggered within the designer interface.
Just replace "Meeting_Type" with your variable, "In-Person" with the actual value you're looking for, and "YourForm" with the published identifier of your form.
The URL in this example is using a relative path, so you don't need the full https://server piece, but you could use the full URL if you want.
I used a relative path because it could potentially be filled out from our internal or external server and a relative path makes it work for both.
In my case, I have it redirecting back to the form when the user has to enter additional information for another submission, but when that isn't needed it just stays on the "thank you" page.
You can do this by using gateways in Forms. Here is some documentation on them: https://www.laserfiche.com/support/webhelp/Laserfiche/10/en-US/administration/#../Subsystems/Forms/Content/Gateways.htm
If you have other questions after reading through that information, feel free to ask.
Do you mean redirect in terms of the "On Event Completion" type of redirect?
Sorry, guess that wasn't very clear.
We have Virtual and In-Person meetings. When the meeting is In-Person we have laptops at the doors to the room with a Confirmation form. Each person enters their email address as a confirmation that they attended. In this case, I'd like to the form to redirect back to itself, but still complete the processing of the submission.
If the meeting is Virtual, I do not want the form to redirect, I just want it to show the Thank You screen and complete the processing of the submission.
So I'm looking for a way to redirect the form back to itself, but only based on a condition.
Okay, in that case, if you have a variable on the initial form that determines that value, then you could do this with JavaScript in the "Thank You" page code that will check the variable and initiate the redirect when the desired value is found.
The important thing to note is that you can only use values present on the submitted form, so if the "remote vs in-person" value is determined after submission, then there's no way to detect it on the thank you page.
For example, in the HTML tab for the "On Event Completion" follow up message, you could add a script tag at the bottom, like this:
<script> $(document).ready(function(){ if(window.top==window.self){ if('{/dataset/Meeting_Type}' == 'In-Person'){ window.location.replace('/Forms/YourForm'); } } }); </script>
NOTE: The if(window.top==window.self) condition is there as a simple way to prevent the code, especially the redirect, from being triggered within the designer interface.
Just replace "Meeting_Type" with your variable, "In-Person" with the actual value you're looking for, and "YourForm" with the published identifier of your form.
The URL in this example is using a relative path, so you don't need the full https://server piece, but you could use the full URL if you want.
I used a relative path because it could potentially be filled out from our internal or external server and a relative path makes it work for both.
In my case, I have it redirecting back to the form when the user has to enter additional information for another submission, but when that isn't needed it just stays on the "thank you" page.
Thank You!!
Jason,
For some reason it didn't work. I got the following error message, but I'll keep trying to manipulate what you sent to see if I can get it to work.
Laserfiche Forms has encountered a problem.
The process associated with the page you are trying to view has been deleted. Contact your Laserfiche administrator for more information. [LFF2103-ProcessDeleted]
That error makes it sound like the URL is not valid.
Double check your redirect URL because the redirect is working, the error is just telling you that it's sending you to the wrong place.
I got it, I re-copied your code and forgot to change the URL.
It works perfectly.
Thank you so much!!!!