Sibylle Koczian wrote:
> "Ed Leafe" <[EMAIL PROTECTED]> schrieb:
>> On Aug 24, 2008, at 10:20 AM, Sibylle Koczian wrote:
>>
>>> In spite of this the control shows the first entry. But if I save
>>> the record
>>> the clientfk is 0 and not the primary key of the first list entry
>>> (which is
>>> 1).
>>>
>>> So I'm afraid this is worse than it was before. Value and
>>> PositionValue seem
>>> to have got mixed up.
>> Can you add a couple of debugging lines to the code and let me know
>> what it prints out?
>>
>> ## *!* ## Dabo Code ID: dDropdownList-dPage
>> def afterInit(self):
>> biz = self.Form.getBizobj("hours")
>> (names, pks) = biz.getClients()
>> print "NAMES", names
>> print "PKs", pks
>> self.Choices = names
>> self.Keys = pks
>> self.ValueMode = "Key"
>> self.PositionValue = 0
>>
>>
>> If you have ValueMode = "Key", you need to have a key that equals
>> zero, based on the error message above. I just want to make sure that
>> that key exists in the Keys property.
>>
>
> I can answer that without running the application: the key zero
> _doesn't_ exist. I had expected that by explicitly setting PositionValue
> to zero Keys and Choices would both be set to the values belonging to
> the first list entry (Key = 1 and Choices accordingly). This may be
> rather silly for the present case, but of course there are lookup tables
> where the first entry is chosen most often and should be preselected.
> That shouldn't mean it must have a primary key of 0, should it?
You are correct, you should be able to set PositionValue to 0, and get
the first item selected, regardless of what key it is. I believe the
traceback you posted wasn't from the setting of PositionValue, but from
an update cycle either before or after your code to set PositionValue.
Paul
_______________________________________________
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]