Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to model complex multi page forms with conditional branches?

Tags:

html

forms

It has occured to me that a large part of my job is really just building the same thing over and over again.

These are fundamentally complex multipage forms e.g. mortgage applications, insurance, etc.

Is there a common / well used model for such things? I don't care what language / technology is used. I'm thinking XML / language neutral ideally.

like image 966
Jonno Avatar asked Jun 01 '12 15:06

Jonno


People also ask

How do I create multiple criteria branching questions?

Forms multiple criteria branching. 1 1. Click onto the ellipses (...) menu, top right of the screen (next to Share ). 2 2. Click onto Branching. 3 3. Configure your questions as needed (see image below).

Why use a multi-page form?

Why Use a Multi-Page Form? Before we jump into multi-page form examples, let’s look at why you should consider breaking long forms into multiple pages. Sometimes in order to get a site visitor to convert, you need to get a lot of info from them. In fact, unlike simple contact forms, you might need much more than just a name and email.

How do you use conditional logic in HTML?

Therefore let’s do the base setting for using conditional logic. First, you place three multiline text boxes via drag-n’-drop beneath the page divider. Reminder: We’ve chosen Request, Information and Feedback as selected values (see step 5) so that we need three suitable text boxes.

How to add conditional logic to a Wordpress page?

First, you put it on the bottom of the page via drag-n’-drop. Then you click on “ edit ” and select the “ advanced ” tab to use the conditional logic again.Now we have several steps to consider. (1) First click on “ add a set of conditions ”.


2 Answers

You can also use http://www.springsource.org/spring-web-flow:

Spring Web Flow is a Spring MVC extension that allows implementing the "flows" of a web application. A flow encapsulates a sequence of steps that guide a user through the execution of some business task. It spans multiple HTTP requests, has state, deals with transactional data, is reusable, and may be dynamic and long-running in nature.

It is perfectly integrated also in Groovy & Grails (Webflow Doc) . Groovy is an script-like extension of Java, whereas Grails is webframework that uses among other things Spring, Hibernate...

like image 155
matcauthon Avatar answered Jun 04 '23 14:06

matcauthon


Personally I use Django to build my forms. I've done complex multi-step forms, where steps are conditional by using the django.contrib.formtools.FormWizard and using a factoryfunction to create the Form class for the step like this:

class SomeWizard(FormWizard): 
    def process_step(self, request, form, step):
        if form.is_valid() and step == 0:
            #compute step 2
            Step2 = second_step_factory(form)
            self.form_list[1] = Step2

And the step it with a placeholder when instantiating the Wizard object:

def some_form_view(request):
    Step1 = first_step_factory(request)
    placeholder = second_step_factory()
    return SomeWizard([Step1, placeholder])(request)

In Django 1.4 the FormWizard has been replaced by a different implementation, I've not looked at that yet.

If you want a language neutral, more declarative option, you can have a look at XForms. Browser support seems a bit abandoned, but there are XSLTs that will transform your XForms into HTML.

like image 31
Chris Wesseling Avatar answered Jun 04 '23 14:06

Chris Wesseling