Oct 2nd, 2009, 11:11 PM
I adjusted the code a little and I think I made a little progress... by adding in the following two snippets:
Into the code as shown here:
Now when running tests, if you error during validation, the fields don't maintain their values -- but if you only error on the name's uniqueness, they do keep their values.
PHP Code:
$fields = array_merge($fields, $_SESSION["form_tools_form"]);
PHP Code:
$fields = array_merge($fields, $_POST);
Into the code as shown here:
PHP Code:
// no errors - great! Now we process the page. The ft_api_process_form does
// the job of both updating the database and redirecting to the next page
if (empty($errors))
{
$params = array(
"submit_button" => "submit",
"next_page" => "reg_confirm_new.php",
"form_data" => $_POST,
"finalize" => true
);
$criteria = array(
"col_2" => $_POST["Team_Name"]
);
if (!ft_api_check_submission_is_unique($ft_id, $criteria, $fields["form_tools_submission_id"]))
{
// uh-oh! A submission already exists with this email address! Abort, abort!
// here, you could do something like set a variable like: $already_exists = true
// and in the webpage do a little test to see if it's set. If so, let the user know
// what's going on
$already_exists = true;
$fields = array_merge($fields, $_POST);
}
else
{
// call ft_api_process_form function here to continue processing the form submission
ft_api_process_form($params);
$fields = array_merge($fields, $_SESSION["form_tools_form"]);
} } } }
Now when running tests, if you error during validation, the fields don't maintain their values -- but if you only error on the name's uniqueness, they do keep their values.