[html-formfu] Date field - changing the order of the sub fields

Carl Franks fireartist at gmail.com
Fri Oct 3 15:04:26 BST 2008


2008/10/2 Ronald J Kimball <rkimball+formfu at pangeamedia.com>:
> Carl Franks wrote:
>>
>> 2008/10/2 Ronald J Kimball <rkimball+formfu at pangeamedia.com>:
>>>
>>> Is it possible to change the order of the sub fields for a Date field?
>>> That
>>> is, I'm supposed to have them displayed as Month / Day / Year instead of
>>> Day
>>> / Month / Year.
>>>
>>> I understand that Day / Month / Year is generally preferred
>>> internationally,
>>> but we expect most of our users will be more familiar with Month / Day /
>>> Year.
>>
>> Not currently, but that would be good.
>> I'd expect it to work the same way as Deflator::CompoundDateTime's
>> field_order()
>>
>>    elements:
>>      - type: Date
>>        name: date
>>        field_order:
>>          - month
>>          - day
>>          - year
>
> Okay, I've attached an initial patch to add field_order to the Date element,
> based on Deflator::CompoundDateTime.
>
> I don't think it's quite ready to be applied.  It should probably verify
> that field_order specifies all three fields (and each field only once).
> Also, there may be a better way to write the code inside the two field_order
> loops.
>
> Nonetheless, it does work.  I copied tests from date.t to create
> date_order.t, added calls to field_order(), and everything passes.

Thanks,
I'll have a look over it when I get back from holiday.

Cheers,
Carl



More information about the HTML-FormFu mailing list