The problem:

After switching to the new validation method for our widgets (we are
using a global Schema) we added the ignore_key_missing parameter to
support disabled fields, this leads to some problem when you are using
widgets like a CheckBoxList (even a MultipleSelectField I think), if
nothing is selected this type of field will not send any input
parameter.

This means that ATM there is now way to know if this widget was used by
the form (since we don't get an input parameter) or if it was simply
disabled (the behavior is the same), leading to the impossibility of
marking such a field as required and having the validator doing the
right thing as Tim is complaining about.

ATM I can see only two solutions:

1) Removing the ignore_key_missing parameter from our Schema and tweak
thing so that this will work, since we don't let the Schema accept
missing fields the validation will be done by the widget validator and
if not_empty=True you will receive an error otherwise all should work
well.

2) Hack our CheckBoxList (and MultipleSelectField) so that they use an
hidden field with the same name and value "tg_empty" then in
NestedFilter we walk c.p.params and search if this paramter is present
and alone, if it's the only one there we replace it with an empty
string '' otherwise we strip it out.
This feels really hackish to me and I would really like to avoid the
need for such a thing.

The basic problem with 1) is that disabled_fields will not work
anymore, but is this such a big problem? do we really want to support
them if they will make other obvious and more common things not
behaving in the right way if not by using bad hacks? is someone using
disabled_fields? what use case is covered by them?

I never felt in love with disabled_fields and this is one more reason
to not support them from my POV. :D

Anyone someone with another solution?

Ciao
Michele

PS
I will offline starting today until Monday. :-) have a nice weekend
guys.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk
-~----------~----~----~----~------~----~------~--~---

Reply via email to