YearsMonthsWidget

by Mikko Ohtamaa last modified Feb 16, 2011 02:11 AM

YearsMonthsWidget allows the user to enter time spans using a pair of years and months.

Project Description

When to use this widget

When one wants to have user-friendly way to input long time spans. Years using decimals are confusing from the end user perspective. An example situation would be asking the amount of work experience. YearsMonthsWidget can replace DecimalWidget in such situations.

Input validation

A special validator called YearsMonthsValidator should be used always with this widget. Otherwise the user will receive an exception report when entering invalid data.

Example

FloatField("totalWorkExperience",
searchable=True,
required=False,
validators=YearsMonthsValidator("Proper work experience amount"),
widget=YearsMonthsWidget(
label="Total work experience",
description="Enter years and months", ), ),

Quality assurance

Tested with:

  • Plone 2.1.3
  • Windows XP
  • Opera browser
  • Firefox browser

Unit testing

  • Entering margin and normal values for the widget
  • Validating bad input

References

YearsMonthsWidget doesn't have public demo available currently.

Missing features in the current version

Red Innovation will address these needs for customer requests. The future development is frozen otherwise.

  • Internationalization
  • Other development proposals are accepted

Internals

Years and months are stored as a single floating point number. This number is converted back and forth years/months pair for user presentation. Also, unit testing contains some example code how to fake HTTP form requests for Zope.

Contact

www.redinnovation.com

Current Release

No stable release available yet.

All Releases

Version Released Description Compatibility Licenses Status

Comments (0)