John Fabiani wrote:
> On Monday, August 16, 2010 09:58:34 am Jim Byrnes wrote:
>> John Fabiani wrote:
>>> On Monday, August 16, 2010 08:44:59 am Jim Byrnes wrote:
>>>> I am starting my first Dabo app. I am putting some info from a Sqlite
>>>> database in a dDropdownList. Then I need to populate some other
>>>> controls based on the item selected in the dDropdownList.
>>>>
>>>> Before I proceeded I wanted to make sure I knew how to get the value
>>>> from the dDropdownList so wrote a little test:
>>>>
>>>> ## *!* ## Dabo Code ID: dDropdownList-dPanel
>>>>
>>>> def onHit(self, evt):
>>>> item = self.Form.PwordsCategories.Value
>>>> print item
>>>>
>>>> When I run it I get this:
>>>>
>>>> Dabo Error Log: Mon Aug 16 10:25:40 2010: Could not bind to
>>>> 'categories.Catgegory'
>>>> Reason: 'NoneType' object has no attribute 'Catgegory'
>>>> WebSites
>>>>
>>>> OK, WebSites is what I was expecting but what did I do wrong to generate
>>>> the Dabo error?
>>>>
>>>> dDropdownList RegID = PwordsCategories
>>>> DataField = Category
>>>> DataSource = categories
>>>>
>>>> Here is the afterInitAll if that's helpful:
>>>>
>>>> def afterInitAll(self):
>>>> pwordsBiz = self.getBizobj('pwds')
>>>> categories = pwordsBiz.getCategories()
>>>> self.PwordsCategories.Choices = categories
>>>> self.PwordsCategories.ValueMode = 'string'
>>>>
>>>> self.requery()
>>>>
>>>> Thanks, Jim
>>>
>>> Maybe a mis-spellling:-)
>>>
>>> 'Catgegory'<> 'Category'
>>>
>>> Johnf
>>
>> Thanks for catching that. Getting old I guess, but after I correct that
>> and save/run it I get the same results, but Category in the error
>> message is spelled correctly now.
>>
>> Thanks, Jim
>
> Maybe you are also setting up the values in the wrong method? I think it
> should be afterInit(). I should have noticed that earlier. Also you may have
> to account for the 'None' value in the list if the requery does not return
> anything.
> Johnf
I commented out the afterInitAll method and put the code:
pwordsBiz = self.getBizobj('pwds')
categories = pwordsBiz.getCategories()
self.PwordsCategories.Choices = categories
self.PwordsCategories.ValueMode = 'string'
self.requery()
in the afterInit method but that seemed to make it worse. Nothing from
the dDropdownList was printed and I got a long traceback ending with:
File "/tmp/tmpBai5Sx.py", line 260, in afterInit
self.PwordsCategories.Choices = categories
AttributeError: 'dForm_62236' object has no attribute 'PwordsCategories'
What is this line from the original error message (after correcting the
spelling of Category) telling me:
Reason: 'NoneType' object has no attribute 'Category'
I've Goolged that before but never really found a explanation I could
understand.
I'm not sure what you mean about accounting for the 'None' value.
However, a value is always returned when I select an item from the
dDropdownList.
Thanks, Jim
_______________________________________________
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]