[html-formfu] RFC: enhanced when
Jonas Alves
jonas.alves at gmail.com
Wed Oct 24 19:06:28 GMT 2007
Hi all,
I would like to enhance the "when" attribute to accept something like this:
- type: Password
name: password2
label: Retype Password
constraints:
− type: Equal
others: password
when:
field: password
- type: Required
when:
stash: is_create
value: true
So when the "when" attribute receives a "field" attribute without a "values"
attribute it returns true if the field is filled. Another enhance is to
receive a "stash" attribute that works like the "field" attribute but checks
the stash instead. However it makes it impossible to use both "field" and
"stash" attributes at the same time because the "values" attribute can't
work for both at the same time. To handle that we can make "field" and
"stash" accept an hash ref. The config would look like:
when:
field:
name: foo
values: [1, 2, 3]
stash:
name: bar
values: [4, 5, 6]
And it would do an intersection between the two. If we need an union it
could be something like this:
when:
- type: field
name: foo
values: [1, 2, 3]
- type: stash
name: bar
values: [4, 5, 6]
Another thing that I miss is a way to specify how I want the values to be
compared. Sometimes I don't want to use "eq" and a regex would be more
appropriated:
when:
field:
name: foo
regex: /^\d+$/
Comments on this?
--
Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20071024/a9fb910a/attachment.htm
More information about the HTML-FormFu
mailing list