On 4/29/2010 1:53 PM, Jeff Johnson wrote:
> On 4/29/2010 11:40 AM, Jeff Johnson wrote:
>> I am at the section where we are validating the record. When I click
>> save on a new record, there is no message and it adds a blank record
>> with a date to the cursor. When I close the form and reopen it, the
>> empty records are gone. I have closely inspected the code and it
>> matches the downloaded code and there is no traceback. Everything else
>> works fine.
>>
> Maybe I can answer my own question. I am connecting to the data on the
> dabo site which you probably don't want me mucking with. But shouldn't
> it give me the validation errors?
>
I verified that validateField fires for each field but validateRecord
never fires.
From my Recipes.py:
def validateField(self, fld, val):
print "validateField"
return "" ## validateRecord is better
if fld == "title":
return self.validateTitle(val)
def validateRecord(self):
print "validateRecord"
msgs = []
msg = self.validateTitle()
if msg:
msgs.append(msg)
if not self.Record.date or self.Record.date <
datetime.date(1990, 1, 1):
msgs.append("There must be a valid date.")
if msgs:
return "The recipe '%s' could not be saved because:\n" \
% self.Record.title.strip() +
"\n".join(msgs)
return "" ## all okay
--
Jeff
Jeff Johnson
[email protected]
http://www.VetsFindingVets.org
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]