Maybe you could use an onvalidation function (see http://web2py.com/book/default/chapter/07#onvalidation). You might also consider adding the extra fields directly to the form object (see http://web2py.com/book/default/chapter/07#Adding-extra-form-elements-to-SQLFORM) instead of in the view, which may make it easier to add/display errors. Another option might be using SQLFORM.factory (see http://web2py.com/book/default/chapter/07#SQLFORM.factory) and creating a custom validator ( http://web2py.com/book/default/chapter/07#Custom-Validators). Anthony
On Monday, June 6, 2011 11:55:36 AM UTC-4, David J wrote: > I am trying to figure out how I can do validation on a custom form > > I have an order form; > > I need to set credit card expiration date as MMYYYY > > > I have 2 fields 'expire_month' and 'expire_year' > > In my layout I manually added 2 select boxes; > > <select name="expiry_month"> > <option value="01">Jan</option> > ... > </select> > > <select name="expiry_year"> > <option>2011</option> > ... > </select> > > I need some idea how to validate this input to make sure it is not past > the current date and obviously put the appropriate error message under > the field like the rest of the errors being display. > > Any help would be appreciated. > > Thanks. > >

