[html-formfu] combo box equivalent

Malcolm mjh-formfu at liminalflux.net
Sun Aug 24 21:57:02 BST 2008


Greetings,

I've been learning my way around FormFu (and Catalyst) recently and 
wishing they'd been available a few years ago - they make things so much
easier. :-)

Is there a good way of doing a combo-box type element for a form? I've 
tried several variations, but so far I haven't found anything that doesn't 
end up requiring custom coding on the handler.

This is the closest I've gotten, but their doesn't seem to be a way of 
enforcing the SingleValue constraint.


---
    elements:
      - type: Multi
        constraints:
          - SingleValue
        label: Country
        elements:
          - type: Select
            name: country
            options:
            - [ ]
            - [ 'USA', 'USA' ]
            - [ 'UK', 'UK' ]
          - type: Text
            name: country
            size: 20
            label: or
            constraints:
              - type: Length
                min: 2
                max: 50
                message: Must be at least 2 and no more than 50 characters long
                when:
                    field: country
                    values: undef
              - type: Length
                max: 0
                message: Either select from dropdown or enter here, do not do both
                when:
                    field: country
                    values: ''
                    not: 1




More information about the HTML-FormFu mailing list