[html-formfu] Taking default value when not supplied in query (plaintext)

Wicked bits wickedbits at gmail.com
Fri Oct 15 20:54:11 GMT 2010


I'm still really interested in having a more substantial capability to
propagate default values into the params hash (or another hash) so
it's in sync with internal form representation.

While the plugin approach works for many field types, it doesn't work
for others, like this Date element:

      - type: Date
        name: date
        label: On date
        default_natural: today
        retain_default: 1
        plugins: PropagateDefault   # <-- does not work
        render_processed_value: 1
        strftime: "%m-%d-%Y"
        year:
          less: 38  # data starts 1972/1973?
          plus: 0
        field_order: [ month, day, year ]
        constraints:
          - Required
        filters:
        - TrimEdges
        auto_inflate: 1

This field nicely defaults to today when rendered, but if its form is
submitted without this field, params will not contain it, nor its
default even though retain_default is hinting that it should.

Am I mistaken that there should be a way to propagate default values
for fields that weren't submitted into the post-processed hash of
fields in a way that has that hash have the same fields and values as
used to generate the form html?



More information about the HTML-FormFu mailing list