Closed (won't fix)
Project:
Webform
Version:
7.x-3.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
23 Oct 2011 at 19:49 UTC
Updated:
3 Nov 2011 at 02:04 UTC
Jump to comment: Most recent file
Comments
Comment #1
colemanw commentedQuicksketch: 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:
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?
Comment #2
szaszg commentedHere 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.
Comment #3
quicksketchI 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.
Comment #4
szaszg commentedHere is a sandbox module: http://drupal.org/sandbox/szaszg/1323368
Comment #5
quicksketchOne 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.
Comment #6
colemanw commentedI'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.