Saturday, January 21, 2012

Web2py - remove the "delete" check box

In web2py, the form displayed  to update form containing an input file is like this :
name + input text + "browse" button + [file + delete check box]

Problem : how can I remove this "delete" check box ? Because the image is required. If I check the value is not null, it returns false, because the value is empty.

Solution : it's really easy. In your file just add: requires=IS_NOT_EMPTY
Field('data', 'upload',requires=IS_NOT_EMPTY())

And that's it !

No comments: