What about this? import re if not form.get('date'): print "Tsk! No date entered." raise Exception
if re.search('[a-zA-Z]', form.get('date')): print "Tsk! No fancy date words." raise Exception date = form.get('date') if not form.get('purchases'): print "Tsk! Are you buying or not?" raise Exception if re.search('[0-9]', form.get('purchases')): print "Tsk! For some reason, you can't buy anything with numbers in it." raise Exception purchases = form.get('purchases') Kun wrote: > I have the following if statement that checks if a form is empty: > > if form.has_key("date") and form["date"].value != "": > date=form['date'].value > > else: > print "ERROR: No date entered!" > raise Exception > > I would also like to add another if statement checking if 'date' has any > letters (a-z) in it, and if so, would like to say that "you have to > enter a date with numbers". I am not sure how to alter my current if > statement to do that check so any assistance would be appreciated. > > > On the flip side, I also have a field called 'purchases' where the user > must enter non-numerals, thus i would also like to know how to scan to > see if their entry has numerals and print 'please do not use numbers' if > they did. > > Thanks for your help. -- Dale Strickland-Clark Riverhall Systems - www.riverhall.co.uk We're recruiting programmers. Please see the web site. -- http://mail.python.org/mailman/listinfo/python-list