More usable form elements

Last modified: March 24, 2008 - 05:22

Drupal's forms API is completely extendable through the use of hook_elements(). Drupal is also (as is any project) trying to become much more usable. One way to do this is provide new, easy-to-use, user-friendly form elements. If they're easy to use, chances are module developers will use them. They would ideally use jQuery, jQuery UI, etc, for increased ease of use.

See also:
http://drupal.org/project/elements — this is the module that will be extended to do this
http://drupal.org/project/ui — this is the module that integrates jQuery UI with Drupal.

Suggested elements:

  • Altering the 'date' element to use jQuery UI date selectors: http://docs.jquery.com/UI/Datepicker
  • Adding a 'number' element which can specify a minimum, a maximum, and only allows numbers to be entered. (e.g. you can't type "a" in it)
  • Adding a 'decimal' element which can specify a minimum, a maximum, and a precision, and only allows decimal values to be entered.
  • Adding a 'slider' element which uses http://docs.jquery.com/UI/Slider . Possibly integrate this with the 'number' element.
  • Add a 'color' element. This should produce the exact same effect as the color module's colorpicker, but should be easily extendable.
  • A 'tabs' element. This should work similarly to the 'fieldset' element in that it contains elements, but should use http://docs.jquery.com/UI/Tabs instead.
  • Same thing for the accordian: http://docs.jquery.com/UI/Accordion.
  • Similarly, something for http://docs.jquery.com/UI/Dialog dialog boxes. This is slightly different in that there is only one place for content.
  • An element for side-by-side multiselect lists: http://drupal.org/project/multiselect implements this as a cck field, but it should be turned into a general element for reuse
  • An element that allows you to cycle through a series of options easily. This should be similar to the select element, but would cycle through the options on click/keystrokes.
 
 

Drupal is a registered trademark of Dries Buytaert.