1

I need to create checklist form(s) comprising of a different sets of checks with different ways to enter an answer. The end user (who will prepare checklist) should not need to add fields to the structure or do any other background tasks.

I created new content type called "checklist" with some fields:

  • ChecklistText
  • AnswerOptions
  • Comments

For example Item A:

  • ChecklistText : "Fuel Consumption"
  • AnswerOptions : "Liters|Int"
  • Comments : "Yes"

Item B:

  • ChecklistText : "Engine checked"
  • AnswerOptions : "YesNo|Logical,Name|Text"
  • Comments : "No"

From that data I would need to render a form. Starting with Item A it should display ChecklistText , entry field Liters and entry field comments. Form should then continue with item B and display ChecklistText , checkbox with field to enter name of the person who checked it (or none if it wasn't checked) and no comment field. At the end a submit button.

My idea how to proceed from here on would be : write a custom module to create a form from content. Parse the field AnswerOption to put correct elements on the form , name elements with an ID (from content record) prefix as to not get duplicates and then somehow submit all that. Is this possible at all with existing drupal functions ?

Was searching for similar examples , but the absence of them got me thinking that my approach to this task is totally off the mark ?

Using D7. Very new to Drupal & PHP , but coding since the age of dinosaurs. Hence my approach as a database desktop programmer.

0

The short answer to all this is :

  • Create custom module , use provided Form API
  • Don't parse anything, use Field Collection to add linked nodes
0

You do not need to created a custom module for this. You can created this by using the Webform module. Then you can created a module using the Webform Features module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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