We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Flexible Form Script Extension: Redirect Form on Submission
Topic Started: Jul 6 2012, 07:47 PM (1,482 Views)
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Code Name: Flexible Form Script Extension: Redirect Form on Submission

What the code does: This code works with Reid's Flexible Form Script and allows you to add a URL to redirect the form upon submission.

How to use the code: Install as instructed, edit URL to the URL you want the form to redirect to after submission.

How to install the code:

Below the Flexible Form Script code:
Code:
 
<script type="text/javascript">
//<![CDATA[
(function ($) {
var rURL = 'URL';

form_script.form_id.submit(function () {
form_script.form_id.after('<div style="text-align: center; margin-top: 10px; font-style: italic; font-weight: 700">Redirecting you in 5 seconds...</div>');
window.setTimeout(function () {
location.href = rURL;
}, 5000);
});
})(jQuery);
//]]>
</script>
Edited by Cory, Dec 14 2013, 03:11 PM.
Online Profile Quote Post Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
Actually this is very useful, thanks to the OP
Offline Profile Quote Post Goto Top
 
.Realm
Member Avatar
Crowd in the Face
[ *  * ]
Fancy, Cory! Nice job, Flexible form is one of my favourite codes and these extensions are really useful. ^_^
Offline Profile Quote Post Goto Top
 
Geoffrey
Member Avatar
bury hatchets, keep maps
[ *  *  *  *  * ]
So this takes the user to the designated page after the form is submitted successfully? Just making sure, as the OP was a bit vague.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
That is correct, once the form is submitted, it will redirect the user to a URL of your choice in three seconds. I made it three seconds after the form is submitted because if I didn't add a timeout the page would redirect before the form is submitted.
Online Profile Quote Post Goto Top
 
Geoffrey
Member Avatar
bury hatchets, keep maps
[ *  *  *  *  * ]
Is it possible that the form could take more than 3 seconds to send and therefore the user still not send in the form successfully though? Or does the form always send within 3 seconds if it sends at all?
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
The form doesn't send within three seconds of submitting the form, the page is redirected three seconds after the form is submitted.
Online Profile Quote Post Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
I recommend changing the 3000 to 5000. Sometimes it redirects too early and the form doesnt get submitted, its a pain
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
I have changed it to 5 seconds, though I'm not sure if that will help. How long it takes to submit the form probably depends on browser and connection speed.
Online Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply