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
Weird: form submitting into another forms's DB
#4
Hi guys,

I sat down to look at this tonight & to come up with a decent solution, and it turns out I'd actually already added one in (!). I'm so sorry for not mentioning it sooner, but quite honestly I don't remember adding it. I just tested it out and it seems to work fine.

I'll this up in much more detail in a tutorial, but for now, here's how to configure it properly to allow you to have users submitting multiple API forms at the same time and not get the session data mixed.

These are the three functions that you use for API forms:
ft_api_init_form_page
ft_api_process_form
ft_api_clear_form_sessions

All three of them allow you to pass in a unique namespace that will be used for a particular form. A "namespace" is just a way to partition something off from other things.

What you'll need to do is come up with a string for each form (e.g. "form1" and "form2" - that will act as your namespace). Then make the following changes to your function calls. The following is for your first form (which we're going to give a "form1" namespace).

Code:
// 1. Change this line on EVERY page:
ft_api_init_form_page(X); // X is your form ID (or it's not explicitly passed)

// to this:
ft_api_init_form_page(X, "live", "form1"); // same on every page


// 2. in the $params passed to your ft_api_process_form() function, add in an
// extra key-value pair: "namespace" => "form1" (again, on EVERY page)

// 3. On your final page, change this:
ft_api_clear_form_sessions();

// to this:
ft_api_clear_form_sessions("form1"); // this now only empties the sessions for form 1

Then do exactly the same thing for your second form, only with the "form2" namespace.

And that should be it...

Do let me know how it goes.

- Ben
Reply


Messages In This Thread
RE: Weird: form submitting into another forms's DB - by Ben - May 28th, 2011, 2:25 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)