[html-formfu] "dynamic forms"

Carl Franks fireartist at gmail.com
Wed Mar 26 11:52:57 GMT 2008


On 26/03/2008, Andreas Marienborg <omega at palle.net> wrote:
> Has anyone ever done anything with "dynamic forms", forms that change
>  when the users input changes? Specificaly I was thinking about chaning
>  some constraints based on the selected value in a dropdown.
>
>  The dropdown is a country dropdown, and I would like to change some
>  constraints for mobilephone, address, zipcode etc
>
>  Just wondering how I should implement such a scheme. I could perhaps
>  use when-clauses but it would quickly become cluttered

Mario added the 'when' method for this kind of thing.
I've never used it yet myself, but the code looks sane.

An example of use might be:

  - name: zip
    constraints:
      - type: US_Zipcode
        when:
          field: country
          value: us
      - type: Generic_Zipcode
        when:
          field: country
          not: 1
          value: us

Carl



More information about the HTML-FormFu mailing list