Feb 22nd, 2012, 12:49 AM
AWESOME new features in FT! Mega props to you, Ben & the team!
I have a bit of a prob - and I apologize in advance if this seems rather amature, but I've searched through the forum and tried various suggestions to no avail.
I setup a new form via the api - however, when I attempt to submit a form I am getting a #101 error.
I removed the "initialize" parameter from the ft_api_init_form_page function:
$fields = ft_api_init_form_page(2); ... am I missing something...? I did add SS Validation and I suspect this may be where the issue lies.
Here is what i've got on the form page:
<?php
require_once("../../../formtools/global/api/api.php");
$fields = ft_api_init_form_page(2);
$errors = array();
if (isset($_POST['JoinNow']))
{
$rules = array();
$rules[] = "required,FirstName,Please enter your first name.";
$rules[] = "required,LastName,Please enter your last name.";
$rules[] = "required,Address1,Please enter your address.";
$rules[] = "required,City,Please enter a city.";
$rules[] = "required,State,Please select a state.";
$rules[] = "required,ZipCode,Please enter your zip code.";
$rules[] = "digits_only,ZipCode,Your zip code can only contain digits.";
$rules[] = "length=5,ZipCode,Your zip code must be 5 digits.";
$rules[] = "digits_only,AreaCode,Your area code can only contain digits.";
$rules[] = "length=3,AreaCode,Your area code must be 3 digits.";
$rules[] = "digits_only,PhoneNumber0,The phone prefix can only contain digits.";
$rules[] = "length=3,PhoneNumber0,The phone prefix must be 3 digits.";
$rules[] = "digits_only,PhoneNumber1,Your phone line can only contain digits.";
$rules[] = "length=4,PhoneNumber1,Your phone line must be 4 digits.";
$rules[] = "required,Email,Please enter your email address.";
$rules[] = "valid_email,Email,Please enter a valid email address.";
$rules[] = "required,AcctPwrd,Please enter a password.";
$rules[] = "same_as,AcctPwrd,VerifAcctPwrd,Please ensure the passwords you enter are the same.";
$rules[] = "required,SecretQuestion,Please enter a secret question.";
$rules[] = "required,SQAnswer,Please enter the answer to your secret question.";
$errors = validate_fields($_POST, $rules);
if (empty($errors))
{
$params = array(
"submit_button" => "JoinNow",
"next_page" => "success.php",
"form_data" => $_POST,
"finalize" => true
);
ft_api_process_form($params);
}
else
{
$fields = array_merge($_SESSION["form_tools_form"], $_POST);
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>.......... html body here .....
Form action is posting to $_SERVER["PHP_SELF"]
Fields are being refilled - ex:
value="<?=htmlspecialchars($fields["FirstName"])?>"
Any assistance would be greatly appreciated!
PS. success.php (my thank you page) has the proper code in the header as well:
<?php
require_once("../../../formtools/global/api/api.php");
$fields = ft_api_init_form_page();
print_r($fields);
ft_api_clear_form_sessions();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>.............................
I have a bit of a prob - and I apologize in advance if this seems rather amature, but I've searched through the forum and tried various suggestions to no avail.
I setup a new form via the api - however, when I attempt to submit a form I am getting a #101 error.
I removed the "initialize" parameter from the ft_api_init_form_page function:
$fields = ft_api_init_form_page(2); ... am I missing something...? I did add SS Validation and I suspect this may be where the issue lies.
Here is what i've got on the form page:
<?php
require_once("../../../formtools/global/api/api.php");
$fields = ft_api_init_form_page(2);
$errors = array();
if (isset($_POST['JoinNow']))
{
$rules = array();
$rules[] = "required,FirstName,Please enter your first name.";
$rules[] = "required,LastName,Please enter your last name.";
$rules[] = "required,Address1,Please enter your address.";
$rules[] = "required,City,Please enter a city.";
$rules[] = "required,State,Please select a state.";
$rules[] = "required,ZipCode,Please enter your zip code.";
$rules[] = "digits_only,ZipCode,Your zip code can only contain digits.";
$rules[] = "length=5,ZipCode,Your zip code must be 5 digits.";
$rules[] = "digits_only,AreaCode,Your area code can only contain digits.";
$rules[] = "length=3,AreaCode,Your area code must be 3 digits.";
$rules[] = "digits_only,PhoneNumber0,The phone prefix can only contain digits.";
$rules[] = "length=3,PhoneNumber0,The phone prefix must be 3 digits.";
$rules[] = "digits_only,PhoneNumber1,Your phone line can only contain digits.";
$rules[] = "length=4,PhoneNumber1,Your phone line must be 4 digits.";
$rules[] = "required,Email,Please enter your email address.";
$rules[] = "valid_email,Email,Please enter a valid email address.";
$rules[] = "required,AcctPwrd,Please enter a password.";
$rules[] = "same_as,AcctPwrd,VerifAcctPwrd,Please ensure the passwords you enter are the same.";
$rules[] = "required,SecretQuestion,Please enter a secret question.";
$rules[] = "required,SQAnswer,Please enter the answer to your secret question.";
$errors = validate_fields($_POST, $rules);
if (empty($errors))
{
$params = array(
"submit_button" => "JoinNow",
"next_page" => "success.php",
"form_data" => $_POST,
"finalize" => true
);
ft_api_process_form($params);
}
else
{
$fields = array_merge($_SESSION["form_tools_form"], $_POST);
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>.......... html body here .....
Form action is posting to $_SERVER["PHP_SELF"]
Fields are being refilled - ex:
value="<?=htmlspecialchars($fields["FirstName"])?>"
Any assistance would be greatly appreciated!
PS. success.php (my thank you page) has the proper code in the header as well:
<?php
require_once("../../../formtools/global/api/api.php");
$fields = ft_api_init_form_page();
print_r($fields);
ft_api_clear_form_sessions();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>.............................