On 26/03/2008, Andreas Marienborg <[EMAIL PROTECTED]> 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

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

Reply via email to