Hey guys,
Yeah, neat idea - but as it stands it definitely won't work. The second ft_api_init_form_page() function will overwrite the session information for the first.
However, I DID plan for this when I first wrote the API... but I confess I haven't tested this in a looong time... so fingers crossed I haven't done anything dumb to mess it up in the meantime.
There's a hidden third parameter you can pass to the ft_api_init_form_page() function: the namespace. To explain: by default all form data that's stored in sessions while the user progresses through the form is found at this location:
The "form_tools_form" is the default namespace. That contains things like the form ID, submission ID etc:
So in other words, EVERYTHING about that form submission is found in $_SESSION["form_tools_form"].
If you need to load multiple form information on the same page, you'd need to change the namespace to prevent conflicts, e.g. storing the data here:
You'll also need to let all the other API functions know that you're using a custom namespace by feeding them that value. Here's some example calls:
Hope this is kind of clear. One thing: be sure to only feed in that custom namespace for the SECOND form's API function calls.
- Ben
Yeah, neat idea - but as it stands it definitely won't work. The second ft_api_init_form_page() function will overwrite the session information for the first.
However, I DID plan for this when I first wrote the API... but I confess I haven't tested this in a looong time... so fingers crossed I haven't done anything dumb to mess it up in the meantime.
There's a hidden third parameter you can pass to the ft_api_init_form_page() function: the namespace. To explain: by default all form data that's stored in sessions while the user progresses through the form is found at this location:
PHP Code:
$_SESSION["form_tools_form"]
The "form_tools_form" is the default namespace. That contains things like the form ID, submission ID etc:
PHP Code:
$_SESSION["form_tools_form"]["form_tools_form_id"]; // e.g. 10;
$_SESSION["form_tools_form"]["form_tools_submission_id"]; // e.g. 125;
So in other words, EVERYTHING about that form submission is found in $_SESSION["form_tools_form"].
If you need to load multiple form information on the same page, you'd need to change the namespace to prevent conflicts, e.g. storing the data here:
PHP Code:
$_SESSION["form_tools_form2"]
You'll also need to let all the other API functions know that you're using a custom namespace by feeding them that value. Here's some example calls:
PHP Code:
// form_tools_form_9 is our new namespace
ft_api_init_form_page(9, $pp["mode"], "form_tools_form_9");
// pass in the custom namespace
$params = array(
// ... other vals here
"namespace" => "form_tools_form_9"
);
ft_api_process_form($params);
// tell the session clearing function to empty sessions for this custom namespace
ft_api_clear_form_sessions("form_tools_form_9");
Hope this is kind of clear. One thing: be sure to only feed in that custom namespace for the SECOND form's API function calls.
- Ben