Issue summary goes here.

CommentFileSizeAuthor
#2 horizontal_7.x-3.13.diff2.49 KBszaszg

Comments

colemanw’s picture

Quicksketch: thanks again for your tireless work on this project and other contributions to the Drupal community. I am the author of the Webform CiviCRM integration module and I appreciate the hooks you have added to this branch which make such integration possible.

One of the most asked-for features with webforms (and drupal forms in general) I have come across is the ability to place multiple fields on the same line, i.e:

First Name ______________ Middle Name ________________ Last Name __________________

To my knowledge there is no easy way to do this, although certainly it can be done. The current options I am aware of:

  1. Writing custom CSS to target the particular fields you want to inline
  2. Writing a template override which generates table markup or css wrappers around the fields you want to inline
  3. Installing the arrange_fields module and drag-dropping your fields inline

The first two options require custom coding and therefore exclude most users. The third is unfortunately too problematic for me to recommend in most situations. webform_conditional is fundamentally incompatible with some rather important things (such as fieldsets, conditional fields, non-js browsers, and collapsible fieldsets).

My idea is to follow the example of Views and provide a simple option to display fields inline via the Webform GUI. I believe this can be achieved by adding a checkbox to $form['extra'] on the webform_component_edit_form. Checking the box would cause a CSS class 'webform-inline' to be added to the element's wrapper when displayed. We would then add to the module's css file to display those divs as either float:left or display:inline-block (not sure which is best).

So, does this sound reasonable to you, and would you be willing to review such a patch?

szaszg’s picture

StatusFileSize
new2.49 KB

Here is my patch...

This adds two checkbox to fieldset settings:
- horizontal container - enable horizontal arrangement
- remove decorations (border, margin, padding) from fieldset, so we completly 'hide' the fieldset container

So, not the components (webform items), but the fieldsets configured as 'horizontal container'.

We can make "complex" layouts, e.g. two vertical fieldsets in a horizontal one, etc.

quicksketch’s picture

I would prefer to leave such layout problems to a separate module. You can easily make your own component type (similar to a fieldset) that provides this functionality though hook_webform_component_info(). I personally think it would be preferable to making the fieldset component suddenly responsible for display logic.

szaszg’s picture

quicksketch’s picture

Status: Active » Closed (won't fix)

One more option: Display Suite (http://drupal.org/project/ds) which also works with Webform. See the screencast: http://vimeo.com/9214091

Thanks for putting your code up on drupal.org. I'm moving this to won't fix, as it won't be included directly in Webform core.

colemanw’s picture

I've done a bit more work on the above module and published it as Webform Layout. It creates a container that allows fields to be arranged in rows and columns. I hope people will find it useful.