El Domingo 16 Julio 2006 22:08, Jorge Godoy escribió: >Javier Rojas <[EMAIL PROTECTED]> writes: >> I have a multipleSelectField, and when I use a validator with it, the >> validation and conversion is made over every selected element (e.g, with >> validators.Int); if I select no items from it, the validator doesn't get >> called. I need the validator to check if the list (the selected elements) >> is empty. What validator should I use? > >The same. There are several possibilities on what you can do with an empty >input. Take a look at the docs for the validators and you'll see, for >examplo, if_empty, not_empty et al. No, it didn't work. I used the not_empty=True with a validator.Int, but nothing happened.
I wrote a validator that always raises an Invalid exception when called, and used it with the MultipleSelectField. It is only called when there is some element selected, when none is selected, nothing happens. >> how can I use validators with compound widgets? I've defined validators >> for all the elements within the compound widget, but they don't seem to >> work. >Take a look at the Select Shuttle I posted in another message. Yes, you use compound widgets, but that doesn't answer my question. What I need (and I didn't find it on your code -since is the definition of the widget-), is to know which validators can I use with the compoundWidget. Following the example of the SelectShuttle widget, I would like to see an example, sort of a line like this mywidget=SelectShuttle(validator=validators.????????) or anything that allows to the validators within the compound widget to show its error messages again, all the widgets within the compound widget have a validator, and when some of them should raise an Invalid exception (and show the error message, and all that), nothing appears. -- Javier Rojas GPG key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xA1C57061
pgpzhWoYhNfRa.pgp
Description: PGP signature