Wow, very fast answers :-) Can a custom validator get access to several fields of the Form?
For example, if i make a checkClosingDate validator , how can my validator read both the ClosingDate (the date to validate) and the "Fixing Date" (support data) - in the creation case where Fixing date is another field of the SQLForm - in the update case where Fixing date is an attribute of the record being updated Regards On Jan 7, 2:48 pm, mdipierro <[email protected]> wrote: > you need to define your own validators like > > class VALIDATOR: > def __init__(self,...): pass > def __call__(self,value): > if valid value: return (value,None) > else: return (value, error_message) > > On Jan 7, 2:22 am, Manakel <[email protected]> wrote: > > > Hello All, > > > I'm just discovering web2py and i'm not able to wrap my mind about the > > Form level validation inside it. > > > Let's say we talk about a defect. This defect has a "Fixing > > Date" (date where provider deliver the fixing code in integration > > system) and a "Closing Date" (date where the customer confirm issue is > > solved in production system) > > > Basically, i understand how i can check the data integrity when using > > SQLForm. > > -> this will check that the "Closing date" is a real date > > But i don't understand how i can perform business level check when > > using SQLForm > > -> this may be real date , but it's a date in the future so i don't > > allow the insertion/ update of the record (Business rules) > > -> this may be a real date, and date is today or in the past, but it's > > before the "Fixing Date" so i don't allow the insertion/ update of the > > record (Business Rules) > > > What is the recommended way to handle this kind of form level > > validation in web2py? > > (hopefully without having to save non valid data (versus business > > rules) inside the db during the process) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

