Last week I've spent trying to make easy composable elements.  So that
you could build an element out of many others - and then just add an
inflator to compose all the individual field values to the value of
the whole.  First of all I wanted a flexible DateTime element.

The result is attached (you'll need to change the line use lib
'../html-formfu/HTML-FormFu-Model-DBIC/t/lib'; in datetime.t so that
it can find the Model-DBIC testing library).

Here is the element definition:

- type: Composed
    inflators:
      - type: ComposedDate
    elements:
      - type: Block
        elements:
          - type: SelectYear
            label: 'Date'
            name: year
            years:
              prefix: '-- Year --'
              less: 0
              plus: 10

          - type: SelectMonth
            name: month
            months:
              prefix: '-- Month --'

          - type: Select
            name: day
            value_range:
              - '-- Day --'
              - 1
              - 31

      - type: Block
        elements:
          - type: Select
            label: 'Time'
            name: hour
            value_range:
              - '-- Hour --'
              - 0
              - 23

As you can see you can build the Date element out of individual
Selects arranged into Blocks etc - so this works - but the
stringification is still a hack.

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/

Attachment: ComposedDate.tgz
Description: GNU Zip compressed data

_______________________________________________
HTML-FormFu mailing list
[email protected]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to