FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
null submissions, not finalized
#1
I just lauched the first form using FT2, and realised submission id numbers are not continuous

i am very worried of missed submissions, here is a detail of the latest received submissions, nothing has been deleted or changed in the admin side
i have verified that i am showing all the submissions in my view filters
any ideas ?


if i look at the mysql database, these entries exist, everything but the submission id is blank, and the submissions not finalized
btw my form uses rsv to make some fields mandatory

here is my code on the form page

PHP Code:
<?php
require_once("/api.php");
$fields ft_api_init_form_page(1);
$params = array(
  
"submit_button" => "continue_button",
  
"next_page" => "new_center_thanks.php",
  
"form_data" => $_POST,
  
"finalize" => true
    
);
ft_api_process_form($params);
?>


and the thanks page

PHP Code:
<?php 
require_once("/api/api.php");
$fields ft_api_init_form_page();
ft_api_clear_form_sessions();
?>

very strange.... any ideas ?

could it be that the database entry is sometimes created just by loading the page w/o submitting the form ?

thanks

alex
Reply
#2
Yes, it looks like when the page with the form is loaded it creates an entry (unfinalized) in the mysql database
is there any way to prevent this, it would be better for what i want to do if the entry are created only when the form is submitted

thanks

alexis
Reply
#3
By using PHP validation and changing the position of the ft_api_init_form_page() function as per the following sample code, I found I was able to create database entries but only when the form is submitted.

PHP Code:
<?php

require_once("/httpdocs/formtools/global/api/api.php");

if(isset(
$_POST['form_submitted']))
{
  
$rules = array();
  
$errors = array();

  
$rules[] = "required,fm_name,Please enter your name.";
  
$rules[] = "required,fm_email,Please enter your email address.";
  
$rules[] = "valid_email,fm_email,Please enter a valid email address.";
  
$rules[] = "required,fm_subject,Please enter a subject.";
  
$rules[] = "required,fm_message,Please enter a message.";

  
$errors validate_fields($_POST$rules);

  if(empty(
$errors))
  {
    
$fields ft_api_init_form_page(1);

    
$params = array(
      
"submit_button" => "form_submitted",
      
"next_page" => "thankyou.php",
      
"form_data" => $_POST,
      
"finalize" => true
    
);

    
ft_api_process_form($params);
  }
}
?>
Reply
#4
Hey guys,

Interesting thread. Just so I understand - what's the problem with not having continuous ID numbers? Is it purely aesthetic, or did you have a specific use in mind for those IDs that require sequential numbering?

Alexis, you're quite right about the submission ID being used every time a new person reaches the form. The API code works by creating a new row in the database (which increments the counter by one), then one each page in your form, updates the row bit by bit depending on the contents of the page's POST vars.

- Ben
Reply
#5
Hi Ben,

In my case, I don't have a problem with NOT having continuous ID numbers, I simply wanted to prevent the build up of 'blank' rows in my database. I know they are not visible from within the formtools interface, I just prefer to have entries created only when the form is submitted.
Reply
#6
Ah I see. If that's your concertn, you might just want to look at this API function & run it every now and then:
http://docs.formtools.org/api/?page=ft_a...ubmissions

One trick is to call that function on your form page / thankyou page. It will delete all unfinalized submissions any time someone visits that webpage.

By default it only deletes unfinalized submissions that are over 2 hours old. This wards against accidentally erasing unfinalized submissions for people in the process of putting through a submission right then.

Hope this helps!

- Ben
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)