[html-formfu] Date Element

Carl Franks fireartist at gmail.com
Thu Jul 12 17:26:53 GMT 2007


On 11/07/07, Tobias Kremer <list at funkreich.de> wrote:
> Hi folks,
>
> I'm wondering why there still is no such thing as a Date element consisting
> of three select fields (day, month, year)? Am I the only person who doesn't
> like giving users a stupid textfield for entering dates? I don't like
> JavaScript popup calendars attached to textfields either. And most of the
> sites I checked are using this multi-select-fields approach which makes me
> believe that it's a very common thing users are expecting.
>
> We tried implementing our own Date element with FormFu but due to its beta
> status the documentation still is not good enough to really grasp the
> gazillion of stages involved in processing a form.
>
> Our latest approach involved subclassing the "multi" element and adding three
> select fields to the form in the setup() method. Unfortunately multi is
> not a real field element, thus it's not possible to set a value on it
> (some composite ISO-formatted date, for example) and now we're stuck with
> three individual values for year, month and day, so inflators and constraints
> on the multi/date element won't work. In an earlier thread Carl
> suggested overwriting is_field and get_fields to make multi look like a
> real element. No problem for is_field, but I really don't have a clue what
> the new get_fields method should look like and if this would work at all :(
>
> So, Carl, may I kindly ask for something like a Date element because it looks
> like currently you're the only person capable of implementing this in a sane
> way :) FormFu is the best form engine currently available but without a
> user-friendly date element it's almost useless for us because dates are
> everywhere in our application :( And whose application doesn't feature dates
> in at least one form?

Would you propose that from the following input...

day => x,
month => y,
year => z

... $form->params should return:

{
  day => x,
  month => y,
  year => z,
  date => DateTime(x-y-z),
}

or:

{
  date => DateTime(x-y-z),
}

or something else?

Carl



More information about the HTML-FormFu mailing list