Form Builder Help: Populate/Pass Variables from Previous Form Session?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
SINphul
Forum Members
Forum Members
Posts: 23
Joined: Wed Jan 07, 2009 3:24 am

Form Builder Help: Populate/Pass Variables from Previous Form Session?

Post by SINphul »

Hello all.  I have a question regarding a registration form I am building on my website.  Basically, it's a one page form where parents will go to register their child for the upcoming school year, meaning it requests both parent and child info.  The form I've built works just fine but I need some added functionality, per the request of my client.

They'd like to present the user with an option to select if they have an additional child to register (in addition to the one they are presently registering) to the school.  If this "additional children" option is true, upon submit they'd like 1) the system to enter that first child into the database, and then 2) bring the user back to the form again to enter the additional child, but with the parent information they entered on the first form to be prepopulated in the fields (so they do not have to spend the time entering the same information more than once).  Otherwise, should the user select that they have no additional children, upon submit, it just kicks them to the submission page.

This process would need to repeat for however many children the user may potential want to register (be it 1, 2, 3, etc.).  Is this something that could easily be done?

The only thing I could think of that might work was the option to write to a User Defined Tag (UDT) if the "additional child" option was true and have that tag call the form again and input the parent information as default values.  The problem with that is I'm a bit of a novice user still, and don't really know where to begin on that.

Does anyone have any incite into adding this functionality?  Or perhaps an easier alternative method that I'm unaware of?  Any help would be greatly appreciated.  Thanks!

Michael
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Form Builder Help: Populate/Pass Variables from Previous Form Session?

Post by calguy1000 »

This is something that is not that easily done.

You need to add a UDT, to detect if that box is checked,, you are correct.
Then things need to be stored in the session, the redirect called (back to the original page).... and the default values submitted.

it's all possible with some php knowledge, and some smarty knowledge, and some addon modules.
but it's not simple.

Formbuilder isn't made for building complete applications, or even 'logical workflow' solutions.  It's made for building simple forms.  If you want something more complex than a simple 'fill in this stuff.... send the results here...' solution, then some funkiness has to be added,

That 'funkiness' requires more than a basic understanding of the underlying technologies.

Formbuilder has some stuff built in to make some of this workflow easier in one-off situations.... but it is not, and never will be a complete 'I can build an application out of this' solution.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
SINphul
Forum Members
Forum Members
Posts: 23
Joined: Wed Jan 07, 2009 3:24 am

Re: Form Builder Help: Populate/Pass Variables from Previous Form Session?

Post by SINphul »

Hi again Calguy.  Thanks so much for confirming my thoughts.  Now I'd like to discuss possible implementation, if you or anyone else would like to comment/contribute on how to pull this one off.

Using some information on another post in the forum, I set a "redirect based on pulldown," with the option of "additional child" set to redirect back to the form page.  Otherwise, the user is sent to a separate thank you page.

Again, using a solution Calguy presented to another user, I created a UDT called 'save_fb_to_session' with the following contents:

Code: Select all

$_SESSION['fbparams'] = $params;
I then added the "call user defined tag" disposition to my form and selected "save_fb_to_session."

Finally, in the page that calls the form, I added parameters to set the default values of the parent information, using something like the following:

Code: Select all

{cms_module module='FormBuilder' form='registration' value_fld25=$smarty.session.fbparams.Address}
The above, being an example of how I assumed to set the address field (number 25) default value to be the session variable.  The only thing is that I'm not entirely sure that is the proper variable, since the post I reference didn't go into great detail on how to use it, and I'm still learning.  That said, it didn't load any default variables after submission...it just reloaded the form with all fields empty (as if for the first time).

If anyone would have any incite into how I could possibly get this working, it'd be greatly appreciated.  Again, thanks Calguy for your initial comments!
musicscore
Power Poster
Power Poster
Posts: 496
Joined: Wed Jan 25, 2006 11:53 am

Re: Form Builder Help: Populate/Pass Variables from Previous Form Session?

Post by musicscore »

I also want to write an udt but do not know how the pass the value's from the form to my udt
So, how can i extract the value's from the form to a udt.

Please help

Musicscore
eus
Forum Members
Forum Members
Posts: 40
Joined: Fri Jan 16, 2009 12:56 pm

Re: Form Builder Help: Populate/Pass Variables from Previous Form Session?

Post by eus »

In the form Submission tab: Page to redirect to after form submission: ->none

Use the Submission template to launch your UDT.

Here you can put something like this.

{store_into_table
    id="$id"
    field1="$field1"
    field2="$field2"

    table="table_name"
}

(create udt store_into_table first) and catch the params in the UDT

Hopefully this helps.

Eus
Post Reply

Return to “Modules/Add-Ons”