2

Our site has different type of articles. Based on the type selected, the fields displayed to the user are varied. The ask is to create a multi-step form and include type field on step 1. Based on the type, subsequent steps and fields included in those steps need to vary.

An important ask is that they need the ability to change the type of the article after it has been created. So on day 1 they might create an article with type "single page" but later change it to "multi page" (Multi-page article has all fields in single page plus additional fields).

I looked at Multistep, msnf, webform and webform_conditional modules etc, but they didn't seem to provide the functionality I need. Is creating this using Form API the best approach? Any suggestion?

UPDATE1

Another important requirement: An article could have multiple (0 or many) sections and each section could have multiple subsections. What is the best way to model the content type? Create content type Section and Subsection and then use node references (article will have a nod reference to section; section will have a node reference to subsection)? Using node references, can one to many relationship be implemented?

3
  • 1
    whats wrong with Multistep module?
    – Aboodred1
    May 2, 2013 at 0:41
  • Sounds like this will lead to primarily opinion based answers. A little bit more information would be helpful, too. What's wrong with the modules you mentioned? Are you good with code? You prefer having things written down? Do you prefer clicking stuff together in the backend?
    – leymannx
    Sep 23, 2015 at 9:08
  • Do you mean "task" when you say "ask" in question? Sep 23, 2015 at 11:37

5 Answers 5

1
+100

There are three module(may be two in your case), which can together to achieve what you want in D7. I have done this & client use it on daily basis..

Field Group

Multi Step

Then I have used Conditional Field module to have fields dependent on one another & it works great.

If you find any error in setup, please try the issue queue for patch.

2
  • Thanks for the tip. I will look into those modules. I would like to upvote your answer, but don't have enough points to do so. BTW, I added one more requirement.
    – sdny
    May 2, 2013 at 13:25
  • I saw your requirement. You can do this by help of field group & conditional field. You will need to plan it accordingly & put condition in same manner... Please accept the answer if it solved your problem
    – RajeevK
    May 3, 2013 at 5:56
1

You can start from the basic multiple step form using the Examples for Developers module in Drupal.

The Examples project contains many modules which hopefully illustrate best practices for implementing various Drupal APIs. These modules can be enabled individually, and will typically add menu items to your site, which should guide you through their features. You can then look through the code to see what they are doing.

In the Example module, there is sub-module "form_example", that is for your need. => Tutorial 8: Basic multistep form

1

You can also try the following modules:

  1. Multistep Nodeform
  2. Conditional Fields
  3. Field Group

I have used these modules in one of my project & it works great. Hope these modules works for you.

Note: Multistep Nodeform is module for node forms only but works very efficiently.

1
  • In my situation different field might show up based on taxonomy term selected in the first step , how can I handle it using these modules? Sep 29, 2015 at 8:31
0

You need to use Multistep and Conditional fields modules for the tasks mentioned.

And yes Node reference supports one to many node reference, you just need to add a node reference field in your content type and select the option "Number of values" as per your requirement.

0

You can try the route module

Route module enables the construction of wizard like journeys using Panels. It's mostly useful for developers that require high levels of configurability and flexibility for their multistep forms. Use of Panels gives this flexibility.

To taste an example functionality, please enable route_example module and navigate to /route-example/step-one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.