Validating user input: No SPACES in textbox

9 views
Skip to first unread message

Ruchir Sharma

unread,
Nov 18, 2014, 11:54:00 AM11/18/14
to web...@googlegroups.com
Hello,
I need validated input from user in a particular field. The input entered by user must not contain any SPACES. I can do this in javascript by using onkeypress function but how to do this using SQLFORM.

My code in default.py is as under:
 form=SQLFORM(db.complain,fields=['Description','Topic','Email','CurrentTime'])
    if form.process().accepted:
        response.flash='Complain Registered. ID is: '+ str(form.vars.id)

Database is:
db.define_table('complain',
    Field('Description',length=200, required=True,requires=IS_NOT_EMPTY()),
    Field('Topic',length=10, required=True,requires=IS_NOT_EMPTY()),
    Field('Email', required=True,requires=IS_EMAIL()),
    Field('Status',length=10, writable=False,default='In-Process'),
    Field('CurrentTime','datetime',default=request.now,writable=False))
Reply all
Reply to author
Forward
0 new messages