Hi,
Andrey Lebedev wrote:
> PROBLEM II. Validator weirdness
>
> Next thing I wanted to improve is to add a field to the form.
> Naturally, I added some declarations, so my form and schema looked
> like this::
>
> class MySchema(validators.Schema):
> pwd1 = validators.String()
> pwd2 = validators.String()
> pwd3 = validators.String(not_empty=True , max=5)
> chained_validators = [validators.FieldsMatch('pwd1', 'pwd2'), ]
>
> def createPasswordForm(controller=None):
> field1 = widgets.PasswordField('pwd1')
> field2 = widgets.TextField('pwd2')
> field3 = widgets.TextField('pwd3')
> form = widgets.TableForm(fields=[field1, field2, field3],
> name='myform', validator=MySchema())
> return form
>
>
> New field appeared in the form as expected, but it did not validated
> at all. I am trying to make new pwd3 field required, but form gets
> processed regardless of emptiness of that field. When a developer
> encounters problem like this, he starts to look for a problems in
> form declaration. However, the validation started to work only after
> I added additional argument to test() method::
>
> def test(self, pwd1, pwd2, pwd3=None):
> ...
>
> Now, after I discovered such behaviour, I _could_ explain to myself,
> that if the function ignores a form field, it doesn't matter if that
> field validated or not, but such a knowledge costed me some time
> and, again IMHO, could confuse new users.
I've commented something on this @
http://trac.turbogears.org/turbogears/ticket/721
Sorry for not looking at it before but I haven't been following this ML
too closely lately and I've missed this post.
Alberto
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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
-~----------~----~----~----~------~----~------~--~---