Hello,
the next problem with the "hours" form:
The dDropdownList contains the list of client names, but when "Form.new()" is
executed, nothing is selected, which looks ugly. And I think the following
Info Log entry may be connected with this:
Dabo Info Log: Mon Aug 18 15:00:45 2008: Key '0' not found
That's printed regularly when the form shows a new, empty record. In fact
there is no client record with primary key 0, but why should there be?
The relevant code in BizHours.py:
def getClients(self):
"""Return a 2-tuple of lists of the client names and their keys."""
crs = self.getTempCursor()
crs.execute("select pkid, clientname from clients order by
clientname")
ds = crs.getDataSet()
# Create the lists
names = [rec["clientname"] for rec in ds]
keys = [rec["pkid"] for rec in ds]
return (names, keys)
And in HoursForm-code.py:
## *!* ## Dabo Code ID: dDropdownList-dPage
def afterInit(self):
biz = self.Form.getBizobj("hours")
(names, pks) = biz.getClients()
self.Choices = names
self.Keys = pks
self.ValueMode = "Key"
I just tried with this variation:
self.Choices = ["unknown"] + names
self.Keys = [0] + pks
That works, now "unknown" is selected and the info log message disappears. But
does it really mean a dropdown list must have an entry with key 0, even if
completely artificial?
Thank you,
Sibylle
--
Dr. Sibylle Koczian
_______________________________________________
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]