Form Tools
Form is active for a date range - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: Feature Suggestions (https://forums.formtools.org/forumdisplay.php?fid=7)
+--- Thread: Form is active for a date range (/showthread.php?tid=81)



Form is active for a date range - xulusports - Mar 21st, 2009

Would it be possible to use an end date on a form, after which time the form is unavailable? For example, if a sports league had a sign-up/registration form available until May 31, on June 1, the form page would read, "Sorry, this form is no longer available." This would allow a Client to "forget" about the form and the need to disable it at 12:01am on June 1st.

The end date would be available to edit by the Admin as well as by an assigned Client.


RE: Form is active for a date range - Ben - Mar 21st, 2009

Hi Xulu,

Neat idea! But this would really only be plausible if the forms themselves were generated by Form Tools. What I mean is, Form Tools forms are very much their own entities.

Instead, what you can do is add some PHP to the top of your form page that automatically redirects your users after a certain date. I haven't tested this, but it would look like this:

PHP Code:
$offline_date  mktime(0,0,0,6,21,2009); // June 21st, 2009
$current_date date("U");

if (
$current_date $offline_date)
{
  
header("location: form_unavailable.php");
  exit;


(Make sure you wrap it in <?php and ?> tags - for some reason this forums editor is stripping them out).

Hope this helps!

- Ben


RE: Form is active for a date range - xulusports - Mar 21st, 2009

I see your point. When the form page is called, I would have to query a DB setting to see what the set date is.

Thinking about this some more, perhaps in the same way when when a form is initialized and I am instructed to add the following code:

PHP Code:
require_once("path/to/form_tools/global/api/api.php");
$fields ft_api_init_form_page("""test");
$params = array(
  
"submit_button" => "submit_button_name_attribute",
  
"next_page" => "next_page.php",
  
"form_data" => $_POST
    
);
ft_api_process_form($params); 

...selecting an end date during the form initialization process (Admin capability only) will generate the code to add as you provided above. If I (the Admin) ever change the end date within the form management process, I would be instructed/prompted to add modified code.

Oh well, just thinking out loud. I'll probably play around with this soon. Thanks for letting me use you as a sounding board.

Adam