Sorry for the wait! I spent the day drywalling my bathroom. Glad that's over with...
Here's a solution using the
Submission Pre-Parser module. In case you're not familiar with the module, here's what it's all about. It lets you run your own (PHP) code on incoming form submissions, letting you do really whatever you want with the form submission. In your case, you'd want to look at the form itself and see if it's online or not. If it's offline, redirect the user to a custom "Sorry, this form is offline!" page; otherwise, just add the submission normally.
Here's how to do it.
1. Download and install the module. The module is found here:
http://modules.formtools.org/submission_...wnload.php
Module installation instructions are found here:
http://docs.formtools.org/userdoc/?page=...ng_modules
2. After activating the module through your Modules page, add a new "Rule". Give it the following values:
Status: enabled
When Executed: check "On form submission" and "On form submission, via API"
Rule Name: Offline Form Redirect
Forms: (select all forms)
PHP Code:
PHP Code:
if ($vars["form_info"]["is_active"] == "no")
{
header("location: http://www.yoursite.com/form_offline.php");
exit;
}
You'll need to tweak the URL here to point to a page where you want to redirect the user. I'm assuming it can be the same for every form, but let me know if my assumption is incorrect.
And that's it! Now try disabling a form and putting through a form submission. You should now be redirected to the form_offline.php page (or whatever you called it!).
Couple of final remarks:
- This is rather a nice approach because it's compatible with upgrading. Upgrading won't overwrite any of your settings, unlike if you were to edit the process.php file or change the string values in the language file.
- The one drawback I can think of is that any time you add a new form, you'll need to update the rule to ensure the rule applies to the new form as well. If you find yourself adding forms a lot, I'd suggest adding a link to the Submission Pre-Parser module in your nav menu, so it's always just one-click away. (You can edit your menu in Settings -> Menus -> Edit Admin Menu).
Hope this helps, Frosty. Let me know if I wasn't clear on anything!
- Ben