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
Fields Variable is Empty after Validation with Error
#1
Hey there,

i hope this is the right subforum to post my question to.

I've got a multipage form using the api. Everything is set up and i think is working okay.

The Problem is that if i don't enter all values that are required and submit the page, the fields array is not containing the entered values and therefore they are not reinserted into the form!

I already checked that validation is right, that all the form fields are set up like this:
Code:
<input type="text" name="name" size="30" maxlength="100" value="<?=@$fields['name']?>"/>
.

Here is the header of one of my forms (not the initial page):
Code:
<?php
require_once("../global/api/api.php");
$fields = ft_api_init_form_page();

$errors = array();
// if submitted, process the form fields
if (isset($_POST) && !empty($_POST))
{  
  $rules = array();
  $rules[] = "required,name,Please insert your Name.";
$errors = validate_fields($_POST, $rules);
}

if (empty($errors))
{
  $params = array(
    "submit_button" => "continue",
    "next_page" => "step3.php",
    "form_data" => $_POST
      );
  ft_api_process_form($params);
}

I already tried the following:

1. Verifying via var_dump that fields is really not containing the input
2. Setting $g_session_type = "database"; in the config
3. Deleting or commenting out rules with commas (because i read that this is unsupported) and with html chars like &uuml; (i need them because i am german).
4. Checked the initial page for a valid ft_api_init_form("", "test");

The var dump contains only things from the first page (there i have only 4 radio buttons to choose from so this initial page is always filled completely):

Code:
array(4) { ["form_tools_form_id"]=> string(4) "test" ["form_tools_submission_id"]=> string(4) "test" ["profil_prio"]=> string(9) "thing" ["continue"]=> string(6) "Continue" }

Thanks in advance for your replies, asgaroth!
Hey there,

i reviewed the formtools code and found myself a workaround.
Here is how it currently works (only tested in testing mode):

Code:
if (!empty($errors))
{
  $params = array(
    "submit_button" => "continue",
    "form_data" => $_POST
      );
  ft_api_process_form($params);
  $fields = ft_api_init_form_page();
}

I call ft_api_process_form without changing the page (next_page is not required as the comments in the code state) and then i reinitialize fields with ft_api_init_form_page.

Do you think i can/should keep this as workaround or is there another possibility?

Thanks in advance, asgaroth
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)