Posted on by

Creating Multiple-page Forms in Participants Database

Version 1.5.2 introduced the ability to create forms spread across multiple pages. Each page of the form is a separate submission, each with it’s own submit button which submits the data and takes the user to the next page.

The way multiple-page forms work is each page submits the information to the database, then goes to another form on another page with a different set of fields. The whole series of forms all save their data to the same record. This is accomplished using a session cookie, so the application knows which record the user is filling out.

In Participants Database, each form page is going to have it’s own shortcode which determines which fields are shown on that page. By defining the “action” attribute in each shortcode, the user is taken to the next form page after the form is submitted. Each page shows a different part of the form by setting the fields or group to show in the shortcode on that page.

You may find it convenient to group your fields according to the page they are on. For long, complex forms, it helps orient the user if each section has a title defining the subject the form fields on that page are related to.

Building Your Multi-Page Form

Here is a step-by-step breakdown of how that is done.

  1. In this example, the form fields are set up so that they are organized into groups with each group corresponding to a page.
  2. On the first page, add a signup shortcode that defines the group of fields to show on that page. Put the name (slug) of the next page in the action attribute:
    [[pdb_signup groups="main" action="signup-page-2" submit_button="Next"]]
  3. On page “signup-page-2” put in a record shortcode showing the second page of form controls. Don’t use another “signup” shortcode here, it must be a “record” shortcode:
    [[pdb_record groups="address" action="signup-page-3" submit_button="Next"]]
  4. On the third form page, add another record shortcode with the action attribute set to the “thank you” page where the [pdb_signup_thanks] shortcode is:
    [[pdb_record groups="personal" action="thanks" submit_button="Complete the Signup"]]
  5. There must be a “thank you” page at the end of the series to complete the submission. Place the “thanks” shortcode on this page:[[pdb_signup_thanks]]

The “thanks” shortcode completes the form submission, and any notification emails are sent when that page is loaded.

The user can go forward or back through the form pages (using the browser back or forward buttons) as long as they don’t hit the final submit that takes them to the thanks page. They can even leave the site completely and come back to the form and the fields that were submitted will be filled in (because of the session cookie). The submission can then be completed from that point. If a form is abandoned partway through, the submitted fields will be in the database, but no notifications will be sent.

You can have as many pages as you want, just add more pages with a “record” shortcode.

When organizing your form fields, you can put more than one group per page by specifying the set of groups for that page in the shortcode: groups="main,address". You can also simply list the fields to include on each page using the “fields” attribute in the shortcode.

The “action” attribute can take a relative or absolute path, page slug or post ID.

A Few Things to Know about Multi-Page Forms in Participants Database

Duplicate Record Preference

All multi-page forms use the “Show Validation Error” preference, no matter what setting is selected for that preference. This is for security reasons and to prevent accidental duplicate submissions.

The security consideration is because if an “update” preference was allowed, it would be possible to expose another record if you knew which value to use. For instance, if the duplicate field was “email” and a malicious user wanted to see another user’s data, they could do so if they knew the person’s email.

The duplicate submission problem could happen if someone left the form and came back to it to complete it. A new record would be created for the second session, even though the user intended for the record created in the first form to be completed.

18 thoughts on “Creating Multiple-page Forms in Participants Database

  1. Hi Roland, thank you for a great plugin.

    I thought multi-page forms might work for me but I have a different requirement. I’m hoping to use a fiels of type: radio buttons to hide/show a table record in the form. For example a participant would select a county or nationality with radio button, and a certain input text field would be hidden or excluded from the signup form.

    Is this currently possible with some css and template scripts?

    Thanks,
    Robert

    1. This is certainly possible with a custom template that includes some Javascript for your show/hide logic. That is a pretty easy way to get it done, but you will need to figure out how to handle required fields in the hidden form elements. Best to do your validation on the client side for a setup like that.

      Using Participants Database Custom Templates

  2. Hi Roland,
    this is a great plugin.
    I’m trying to create a multi-participants page form registration or a multi-participants registration on multi-pages form.
    What is the best way to do this?

    Regards,
    Jacques

    1. It looks like you are on the right page for that. Did you try following the instructions found in the Creating Multiple-page Forms in Participants Database article?

      1. Thanks for your reply Roland

        I understand that the multiple-page forms concern the registration to fill one record (one participant). I am trying to create a form to register multiple participants (multiple records).

        Jacques

        1. Oh, I see. That is not possible in a single form. The only way to allow a user to create multiple records is to have them do it one at a time. They will have to submit the form for each record they will create.

  3. Dear Roland,

    Is there a way I can disable the submit button of my online signup form once I reached 20 inscribers? And can I show how many inscribers have already signed up to the form?

    nice greetings,
    Michael

    1. There are several ways to do this, I’ve got an example of a plugin that sets this up, or you can do it in a custom template if you prefer.

      The plugin example I’ve got doesn’t disable the submit button as you suggest, you’d have to use a custom template to do it that way, this one just shows a message instead of the signup form once the limit is reached.

      https://gist.github.com/xnau/230371e3d71d2506b1a84acec436de09

      1. Thank you for your plugin.

        I’ve uploaded the plugin in wordpress, probably
        for my signup form:
        [pdb_signup template="bootstrap" groups="common,naschools,naschools_mk"]
        I can’t find any information which shortcode I need to add

        and what kind of custom temp)late I need to use, do I need to program it myself in php, or can I add a short php code into your plugin to disable the submit button?

        1. You don’t need to use a custom template if you use the plugin I gave in the example, also you won’t need to change the shortcode. Just activate it, and it will work.

          You’ll need to make some modifications to it to conform to your needs, it’s only an example.

        2. I activated your plugin but in the signup form page I don’t see the plugin work, no limitation, no count
          and can I set up the shortcode the limitation depending on different signup forms, for ex. for students sign up it would be max. 25 and for the teachers signup form max. 10?

          And can you please help me how i could disable the submit button once the limitation is reached.
          thank you Roland

        3. Hi Michael,

          I’m sorry, there are a couple of spelling errors in the plugin code. Line 7 should be:

          add_filter( 'pdb-signup_shortcode_output', 'xnau_limit_signups' );

          Also line 17 should be:

          $signup_limit = 100;

          (I’ve updated it in the gist if you just want to re-install it.)

          The example I provided is just to show you how it can be done, you will need to have some coding skills to adapt it to your specific purpose. If you want it to count only certain kinds of records, you can use a “filter” in the [pdb_total] shortcode that is used to count the records.

          List Shortcode Filters

        4. thank you, it is working

          I have some programming skills but I still need some help:

          If I alter your plugin, how can your plugin detect which sign-up form is used so I can use the right filter to display the right count ?

          and if i would disable the submit button what is the right code line I need to add?

          Sorry for my many question, hope you can help me further.
          greetz
          Michael

        5. Hi Michael,

          What you want to do is not simple, the filter receives raw HTML, so in order to identify which form is in use, you’d need to find the information in that string. The form has a hidden field name “shortcode_page” that tells which page the form is on, so you can use that to determine which form it is. It’s kindof doing it the hard way, but passible.

          To disable the submit button, you could alter the HTML to set the submit button to “disabled” but again, tricky because you’ve got to find it in the HTML string.

  4. Is multi-form the same as one record multiple sub-record?

    I’m trying to create a system to report bad social behaviours. One record of a person may have multiple complaints, all recorded under their names.

    A user submits a report of bad behaviour, but someone else may have made a complain too about the same person who is frequently misbehaving.

    Person 1 reports, Genghis Khan for lewd behaviour.
    Person 2 tries to submit a report but finds that Genghis Khan has a record and would like to add a sub-record under his name.
    Person 3 also had problems with Genghis Khan and filed a report on him.

    Is it possible to match records and collate all these records under him?

    1. Yes, if each complaint is a separate record. Then you can list or search based on the person the complain is about.

      1. Cool! Let’s say I did implement it this way. Is there a way to display in list form in a column how many complaints a person the complaint about has?

        Then output a filter in list format in sequential order with people with highest complaints at the top of the list. Is this possible without much hacking?

        1. Yes it’s possible, but you will need to know a bit of HTML and PHP to set up a custom template.

          Using Participants Database Custom Templates

Leave a Reply
You have to agree to the comment policy.

18 thoughts on “Creating Multiple-page Forms in Participants Database

  1. Hi Roland, thank you for a great plugin.

    I thought multi-page forms might work for me but I have a different requirement. I’m hoping to use a fiels of type: radio buttons to hide/show a table record in the form. For example a participant would select a county or nationality with radio button, and a certain input text field would be hidden or excluded from the signup form.

    Is this currently possible with some css and template scripts?

    Thanks,
    Robert

    1. This is certainly possible with a custom template that includes some Javascript for your show/hide logic. That is a pretty easy way to get it done, but you will need to figure out how to handle required fields in the hidden form elements. Best to do your validation on the client side for a setup like that.

      Using Participants Database Custom Templates

  2. Hi Roland,
    this is a great plugin.
    I’m trying to create a multi-participants page form registration or a multi-participants registration on multi-pages form.
    What is the best way to do this?

    Regards,
    Jacques

    1. It looks like you are on the right page for that. Did you try following the instructions found in the Creating Multiple-page Forms in Participants Database article?

      1. Thanks for your reply Roland

        I understand that the multiple-page forms concern the registration to fill one record (one participant). I am trying to create a form to register multiple participants (multiple records).

        Jacques

        1. Oh, I see. That is not possible in a single form. The only way to allow a user to create multiple records is to have them do it one at a time. They will have to submit the form for each record they will create.

  3. Dear Roland,

    Is there a way I can disable the submit button of my online signup form once I reached 20 inscribers? And can I show how many inscribers have already signed up to the form?

    nice greetings,
    Michael

    1. There are several ways to do this, I’ve got an example of a plugin that sets this up, or you can do it in a custom template if you prefer.

      The plugin example I’ve got doesn’t disable the submit button as you suggest, you’d have to use a custom template to do it that way, this one just shows a message instead of the signup form once the limit is reached.

      https://gist.github.com/xnau/230371e3d71d2506b1a84acec436de09

      1. Thank you for your plugin.

        I’ve uploaded the plugin in wordpress, probably
        for my signup form:
        [pdb_signup template="bootstrap" groups="common,naschools,naschools_mk"]
        I can’t find any information which shortcode I need to add

        and what kind of custom temp)late I need to use, do I need to program it myself in php, or can I add a short php code into your plugin to disable the submit button?

        1. You don’t need to use a custom template if you use the plugin I gave in the example, also you won’t need to change the shortcode. Just activate it, and it will work.

          You’ll need to make some modifications to it to conform to your needs, it’s only an example.

        2. I activated your plugin but in the signup form page I don’t see the plugin work, no limitation, no count
          and can I set up the shortcode the limitation depending on different signup forms, for ex. for students sign up it would be max. 25 and for the teachers signup form max. 10?

          And can you please help me how i could disable the submit button once the limitation is reached.
          thank you Roland

        3. Hi Michael,

          I’m sorry, there are a couple of spelling errors in the plugin code. Line 7 should be:

          add_filter( 'pdb-signup_shortcode_output', 'xnau_limit_signups' );

          Also line 17 should be:

          $signup_limit = 100;

          (I’ve updated it in the gist if you just want to re-install it.)

          The example I provided is just to show you how it can be done, you will need to have some coding skills to adapt it to your specific purpose. If you want it to count only certain kinds of records, you can use a “filter” in the [pdb_total] shortcode that is used to count the records.

          List Shortcode Filters

        4. thank you, it is working

          I have some programming skills but I still need some help:

          If I alter your plugin, how can your plugin detect which sign-up form is used so I can use the right filter to display the right count ?

          and if i would disable the submit button what is the right code line I need to add?

          Sorry for my many question, hope you can help me further.
          greetz
          Michael

        5. Hi Michael,

          What you want to do is not simple, the filter receives raw HTML, so in order to identify which form is in use, you’d need to find the information in that string. The form has a hidden field name “shortcode_page” that tells which page the form is on, so you can use that to determine which form it is. It’s kindof doing it the hard way, but passible.

          To disable the submit button, you could alter the HTML to set the submit button to “disabled” but again, tricky because you’ve got to find it in the HTML string.

  4. Is multi-form the same as one record multiple sub-record?

    I’m trying to create a system to report bad social behaviours. One record of a person may have multiple complaints, all recorded under their names.

    A user submits a report of bad behaviour, but someone else may have made a complain too about the same person who is frequently misbehaving.

    Person 1 reports, Genghis Khan for lewd behaviour.
    Person 2 tries to submit a report but finds that Genghis Khan has a record and would like to add a sub-record under his name.
    Person 3 also had problems with Genghis Khan and filed a report on him.

    Is it possible to match records and collate all these records under him?

    1. Yes, if each complaint is a separate record. Then you can list or search based on the person the complain is about.

      1. Cool! Let’s say I did implement it this way. Is there a way to display in list form in a column how many complaints a person the complaint about has?

        Then output a filter in list format in sequential order with people with highest complaints at the top of the list. Is this possible without much hacking?

        1. Yes it’s possible, but you will need to know a bit of HTML and PHP to set up a custom template.

          Using Participants Database Custom Templates

Leave a Reply
You have to agree to the comment policy.