Re: formEncode - complicate validate form
"Grzesiek Slusarek" <[email protected]>
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Organization | Poczta Wirtualnej Polski S.A. http://www.wp.pl/ |
| Message-ID | <[email protected]> |
Ian Bicking wrote:
"
You want a FormValidator, because you are validating pieces
together.
An example of this is
formencode.validators.RequireIfMissing/RequireIfPresent. You
might want
to look at the implementation; how you use that field is:
class MySchema(Schema):
other fields...
chained_validators = [RequireIfPresent(required='birthday',
present='i_am_over_18')]
Form validators validate the entire dictionary that is submitted.
"
As I understand in this example both birthday and i_am_over_18
are form field. But what if I want to do validate some field of
form ONLY if other field has a specific value?
i saw source of formencode.validators.RequireIfMissing/
RequireIfPresent and value of field can be achieved by e.g. value
_dict.get(self.missing) but how called such this validator.
This part i don't understand. And is it possible?
Grzegorz Ślusarek
----------------------------------------------------
KONIEC drogich gadżetów - tapety, polifonia, real music, true tone
już tylko po 4 zł (4,66 zł z vat) - wszystkie nowości i hity:
http://klik.wp.pl/?adr=www.sms.wp.pl&sid=796