I am developing web2py - Models - db_testing.py in pythonanywhere.com
below code is running successfully:
# -*- coding: utf-8 -*- db = DAL('sqlite://storage.sqlite') db.define_table('registration', Field('firstname', requires=IS_NOT_EMPTY(error_message='Should not left blank')), Field('lastname', requires=IS_NOT_EMPTY()), Field('gender', requires=IS_IN_SET(['Male', 'Female'])), Field('birthday', 'date'), Field('email', requires = IS_EMAIL(error_message='invalid email!')), Field('salary', 'integer'), Field('seniority', 'integer') ) However, the first field 'firstname' can only prevent form filling not to left blank. It cannot validate the input is in a-z or A-Z.
The last field 'seniority' can assure form filling must be 0-9, but it cannot prevent form filling not to left blank.
How can I set both requirements (IS_NOT_EMPTY with error_message and assure input is string / integer)?
Any thoughts?
https://stackoverflow.com/questions/66927084/how-to-set-is-not-empty-and-string-not-included-0-9-in-web2py-data-structure April 03, 2021 at 09:51AM
没有评论:
发表评论