For instance how someone can acheive the same than NullBooleanField of Django :
https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.NullBooleanField http://stackoverflow.com/questions/10440937/what-is-wrong-with-the-django-forms-booleanfield-unit-test-case One part of the problem with IS_NOT_EMPTY() is that it seems to be intent to work only with string field type, from the book : IS_NOT_EMPTY This validator checks that the content of the field value is not an empty string. requires = IS_NOT_EMPTY(error_message='cannot be empty!') Gluon code here : https://github.com/web2py/web2py/blob/b6db31461266fa7539636e77f548cd6f69e8063e/gluon/validators.py#L1008 I am not sure what the best way to solve this and how to distinguish between empty checkbox and false checkbox... As in html it could only be checked or not checked... Maybe we can wrapp checkbox into a widget that check if the checkbox was checked before been unchecked... But it would be counter intuitive that someone has to check a checkbox before uncheck it to signify that he want that the database input of a boolean field is really false and not NULL... Or we can just fix IS_NOT_EMPTY() so it works with boolean type field so that it returns false when the checkbox is leave blank as it should... Or even mention in the book that IS_NOT_EMPTY() doesn't apply and shouldn't be use with boolean type field, which seems the simplest solution... Richard On Tue, Mar 8, 2016 at 2:00 PM, Richard Vézina <ml.richard.vez...@gmail.com> wrote: > To me, Francisco is rigth... > > In boolean case, I assume that IS_NOT_EMPTY() would make sure that field > don't get a NULL value, so the database get hit with True or False value > when you set IS_NOT_EMPTY() and default=False... > > Richard > > On Thu, Dec 4, 2014 at 6:27 AM, Kiran Subbaraman < > subbaraman.ki...@gmail.com> wrote: > >> I see this as IS_NOT_EMPTY() working correctly. >> And why would you attach this validator to a checkbox/boolean field? Did >> you also assign a default value of False? >> Or you would need to check request.args for this field, and assign a >> false if it is empty, before passing it along to the validator (again, not >> sure what purpose the validator serves for this field). >> >> ________________________________________ >> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/ >> >> On Thu, 04-12-2014 4:46 PM, Francisco Ribeiro wrote: >> >> hi there, >> I noticed that when I use the IS_NOT_EMPTY() validator on a boolean field >> (i.e. a form checkbox) that it will not allow me to submit the form with >> this field as "not checked" / "unticked". In my opinion, this is a wrong >> interpretation of what is an empty value, since a checkbox can only >> represent True or False and therefore it's never empty. The consequence of >> using this behaviour for the IS_NOT_EMPTY*() validator is that we are >> forcing users to choose True on a widget that is meant to provide a boolean >> choice between True OR False, so the whole purpose of this user interface >> widget, is lost. I only tested this with SQLFORM.factory() though. >> >> Am I missing something? >> >> Francisco >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.