Page branching depending on input (like wufoo)?

How to create conditional page branching in a multi-page ChronoForms form.

Overview

The issue arises when needing to skip or show specific form pages based on user input from a previous page.
Use a PHP action on the second page's load section with conditional logic to return the appropriate page name, then create separate events for each page containing the required fields.

Answered
ChronoForms v8
Hi there,

how can I make my multi-page form branch to / skip pages, depending on user input?

Example: page one asks for a person's name and age, and then if a 2. person's data is to be entered.
If yes, I want to show form page 2 incl. optional, and mandatory fields.
if no, I want to skip page 2, and advance to the final page.

Thanks, any heads up greatly appreciated!
Ben
Max_admin Max_admin 15 Nov, 2023
you can not do this but you can place both fields groups on a single page but in 2 different PHP action events

each event will match a condition
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max, thanks,

php isn't a problem for me, but
wouldn't reacting to user input require javascript instead of php?
Could you draft a tiny, quick and dirty example?

Thanks!
Max_admin Max_admin 16 Nov, 2023
Answer
1 Likes
you need php to process form data after the 1st page has been submitted, javascript is for processing data before submit

the code can be something like this:

if($this->data("test") == "2"){
return "page2";
}else{
return "page3";
}


add 2 events to your PHP action, page2 and page3, then drag the fields you need in both of them

The PHP action should be in the 2nd page "load" section, that makes it process the data from page 1 and show the correct fields
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.