Page 1 of 1

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

Posted: Thu Jan 22, 2009 6:59 pm
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

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

Posted: Thu Jan 22, 2009 7:08 pm
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.

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

Posted: Sun Jan 25, 2009 12:33 am
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!

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

Posted: Wed Mar 11, 2009 12:24 pm
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

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

Posted: Fri Apr 10, 2009 11:49 am
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