7

I'm currently working on a new Drupal 7 site, which will be used as a data collection and reporting site. After much research / trial and error / etc, I've decided to bring this question to this forum, and am sincerely hoping that it won't be thrown out as being "too generic."

I've created a Content Type, which consists of roughly 25 fields, and am wondering what the best approach for having users populate that content would be? Out of the box (even using Manage Display) the form itself still resembles nothing that I'd actually want to present to the users. And, it seems a bit insane to alter the form using one of the hook_form_alter flavors, because the code involved seems way overkill just to hack the form into looking/acting like I intend it to. I've also spent a bit of time with the Webform module, which is ok, but there's still quite a bit of customizing that needs to be done in order to have the form look/act like I intend it to, and there seems to be mixed reviews on that module in general (no offense to anyone!). Same goes for using the Form API...lots and lots of code just to come up with a basic form to collect data.

My latest approach is to simply use the markup type to create the form itself (basically, just straight html / css / javascript, and then populate / update the Content Type behind the scenes. From a developer's point of view, this approach is very, very straight forward - no rocket science - easy to maintain, but I'd certainly like to hear from those of you that know your way around Drupal. Am I overlooking something?

Thanks in advance! cmmsites

5 Answers 5

2

I'm using Drupal for exactly the same purpose. Basically, what I'm doing is using the Field Group module to wrap particular items together in DIV tags so that I can use CSS styles to properly layout my forms.

Drupal provides a very structured set of container elements with appropriately named classes. Accordingly, leveraging the power of CSS to your advantage should be the first thought that goes through your mind when it comes to manipulating layouts.

I mucked with the Webform module, and although it is quite capable, I've found that just sticking with Drupal's standard content type system for collecting information has suited me best. Utilizing Views and the Rules module, I'm able to generate reporting pages that show me the critical information I want with less modular bloat to my Drupal installation.

So definitely read up on Views, Field Group, and the Rules module to see if the functionality as described will fit your bill.

2
  • Lester: I'll take a look at Field Group. Using Views seems to come into play AFTER the data has already been collected...I'm just trying to determine the best / wisest / safest method of getting the data in there in the first place :) Thanks a ton for the feedback...it'd be really sad if there was no one out there to turn to for advice!
    – cmmsites
    Sep 18, 2012 at 20:07
  • Yeah Stack is great, I practically live and breathe these sites. Seriously though, I've had no problems with using Field Group + CSS to get everything laid out the way I need it to be. Sep 18, 2012 at 20:15
1

If you want to move form elements only, you must take a look at Display suit.

You can put the element as you want without write nothing of code. You can see an example what DS let you do

0
0

I you don't need nodes, I'll try with form api and entities. I think it's drupal's future.

It's true that form api it's hack to customice, but it's easy with form api that use a node-form.

Also, if you use the form api you will work as drupal say, if not it'll be hard to have a code for future developers.

Oskar

1
  • Oskar: I'm actually populating the node when the user submits the form. I'll work some more with the Form API as you mention...perhaps I didn't give a fair enough evalutaion. Thanks for the feedback!
    – cmmsites
    Sep 18, 2012 at 20:02
0

I worked with webforms extensively over the past couple of months. I am using Webform module, for some things it's really an overkill, but it really depends what is your form, is it complicated with plenty of conditional fields, validation rules etc.

Try having a look into Entity Forms drupal entityforms

And some interesting read here http://stidwill.com/content/web-forms-dead-long-live-entity-forms

0

I know this question is old, but here is what I think. How you want to use the data is an important determination for how you build the form.

Webform is made for surveys and does it well. It is easy to list your forms and enable/disable them, or change as needed. Each webform has a link to its submissions.

Using a content type (node/entity/whatever) has different permission implications, and allows more flexibility in actions later. You can use the 5-star module or Flag module on a content type, but not on a webform submission.

Making a custom form with the form api is good if you want to process the information yourself and not store it in the database for long term retrieval. I would not go through the trouble of defining a separate form, validation and submission handlers to just do what both node and webform already do. But it sounds like you have already invested the time in doing this. That just goes to prove there is always more than one way to skin a drupal.

Both webform and a custom content type can use the Markup field, https://www.drupal.org/project/markup Both can trigger rules to fire on submission for minor automation tasks (or large automation, depending on your developer's skill) Both have views integration for making a statistics or summary page, if desired. (https://www.drupal.org/project/webform_mysql_views)

So if the question really is only "Which method is easiest for custom form display?" then I would say the answer is the custom content type. Field groups, field collections (rarely needed, irritating to handle, but so useful when they are what you need), and the above mentioned markup field will do most things for you. I have used field groups and js to convert a set of radio buttons into tabs when tabs within vertical tabs were not possible with contributed modules. There was one project I built where the form had 80+ fields with heavy repetition. I made this module for use there because I only needed 6 field styles and I was tired of using field names in the form-alters and having copy-replace errors. https://www.drupal.org/sandbox/developerweeks/1964036

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