Multiple Pages and Conditions

GreyHead 10 Aug, 2013
Hi KaKoRoT,

Please see this FAQ for more about conditional forms.

You can structure a conditional form in several different ways so it's hard to be more specific without knowing what you need to do.

Bob
KaKoRoT 13 Aug, 2013
Hi GreyHead, thanks for your reply.

the form will basically ask a question and depending on the answer, it will have a number of responses, which lead to further questions and more responses eventually coming to an end.

its to be phrased more as a conversation with leading questions etc.

I will take a look at each of the varying ways and see what's best.

Thanks.
GreyHead 13 Aug, 2013
Hi KaKoRoT,

It sounds as though this might be best built with a separate form for each step. You'll need to carefully plan the progression and workout how to set up consistent input names and where to save the results (or partial results) if that is needed.

The Data to Session and Session to Data actions will let you pass data between forms and the Show Form action plus the conditional actions will let you build paths through a tree of forms.

Bob
KaKoRoT 14 Aug, 2013
Hi GreyHead,

let me make sure I got you correctly...

I have to create multiple forms, instead of multiple pages?
GreyHead 14 Aug, 2013
Hi KaKoRoT,

You don't 'have to'. From the description you gave, which is pretty vague, it looks to me like the simplest way of getting this to work. You could also use multi-page but that tends to give you more bigger and more complex forms that are harder to manage.

Bob
KaKoRoT 14 Aug, 2013
lol...I thought about it and came to the same conclusion, as I like to do things in small chunks, so this method suits me.

Whats the correct method in Chronoforms to link each form and keep it all in one session and one database?
GreyHead 14 Aug, 2013
Hi KaKoRoT,

Use the Data to Session and Session to Data actions to pass data from one form to another (I think you need to set session keys to get this to work). And get and include the cf_id (or primary key value) from the current record after the first DB Save; then later DB Saves should update the same record. (Please see this FAQ for more info on the record ID.)

Bob
KaKoRoT 14 Aug, 2013
Thanks GreyHead!! always appreciated!
KaKoRoT 19 Aug, 2013
Hi GreyHead,

Having some difficulties, with this project. I have set-up separate forms
so far I know how to make the form jump to another form after completing a question, using the "Show Form" event,

but I am totally lost on Data to Session, (I am using a Session Key, but have no idea what I need to do to get it all to work)

And also in regards to Custom Serverside Validation and Event Switcher, I thought there would of been more of an 'assistive' part to this, but it all has to be done in code. Any Tutorials on this?

Thanks.
GreyHead 19 Aug, 2013
Hi KaKoRoT,

The Data to Session & Session to Data actions simply save the form data (the contents of the $form->data and $form->files arrays) into the User session and get it back again later.

The User Session is the temporary store that Joomla! creates so that information about a user is stays available as they move around the site. By default it is kept for 15 minutes after their last action.

You use the actions by putting a Data to Session action after any data processing is complete - usually at or near the end of the On Submit event; and put a Session to Data action when you want it back again - usually at the beginning of an On Load and/or On Submit event.

Bob
KaKoRoT 20 Aug, 2013
Hi GreyHead,

Thanks, that makes sense...

so for each form, I do Data to Session, and at the end (last form), Session to Data... then do a DB Save? which should save all the bits of data from each form to the database?

Because I have a form that has a question, the answer will dictate which form is given next, this is where the event switcher comes in?. how do I integrate this into the process?
GreyHead 20 Aug, 2013
Hi KaKoRoT,

Try it with a simple example form and Debugger action so that you can see what data is where.

I'd use a DB Save after each step rather than at the end but either way will work.

Bob
This topic is locked and no more replies can be posted.