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
Validation clearing all data!
#1
Sad 
Hello all. I've got some validation on my form and it works beautifully. Problem is that every time there's an error, the data is not retained in the form, causing the users to have to re-enter it every time.

Here's my pertinent code:
<?php
require_once("/wamp/www/ah/global/api/api.php");
$fields = ft_api_init_form_page(5, "live", "form5");

$errors = array();
if (isset($_POST["submit"]))
{
$rules = array();
$rules[] = "if:element_27!=,required,element_57,Please enter misc details.";
$errors = validate_fields($_POST, $rules);

$criteria = array(
"col_2" => $_POST["element_1"],
"col_1" => $_POST["element_22"]
);
if (!ft_api_check_submission_is_unique(5, $criteria, $fields["form_tools_submission_id"]))
{
$errors[] = "Sorry, you have already placed a submission for this date range. Please contact the appropriate staff to modify your previous entry.";
}

if (empty($errors))
{
$params = array(
"namespace" => "form5",
"submit_button" => "submit",
"next_page" => "thankyouhims.php",
"form_data" => $_POST,
"finalize" => true
);
ft_api_process_form($params);
}
else
{

$fields = array_merge($_SESSION["form_tools_form"], $_POST);
}
}
?>


Help!
Reply
#2
In the markup on your form are you outputting the values?

For example:

<input type="text" name="firstname" size="25" maxlength="50" value="<?php echo htmlspecialchars($fields['firstname'])?>" />

Cheers,

Joe
Reply
#3
Nope! I'll give that a shot and report back.

Thanks!
Reply
#4
Totally worked. Thanks!
Reply
#5
No worries!

Cheers,

Joe
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)