Re: [dabo-users] Very Simple dropdownlist

Author: <lalong1@charter.net>

Posted: 2009-07-12 at 20:29:01

The afterinit is for what object?

> -----Original Message-----

> From: dabo-users-bounces@leafe.com

> [mailto:dabo-users-bounces@leafe.com] On Behalf Of Carey Gagnon

> Sent: Sunday, July 12, 2009 6:01 PM

> To: Dabo Users list

> Subject: Re: [dabo-users] Very Simple dropdownlist

>

> Still no luck. This is the code now:

>

> def afterInit(self):

> statesdropdown = SPLDropdown(self, DataSource =

> ClientBizobj, DataField = "stateprov")

> locations = ({"state": "Select", "iid": 0},

> {"state": "Ak", "iid": 1},

> {"state": "Ga", "iid": 2},

> {"state": "Tx", "iid": 3})

>

> choices = []

> keys = {}

> for location in locations:

> choices.append("%s" % (location['state']))

> keys[location["iid"]] = len(choices) - 1

> self.Choices = choices

> self.Keys = keys

> self.ValueMode = "key"

>

> #####################################

>

> SPLDropdown is the RegID I gave to the drop down list.

>

> Now I get the error:

> NameError: global name 'SPLDropdown' is not defined

>

>

> N00bs R Us

> Carey

>

>

>

> On Sun, Jul 12, 2009 at 4:31 PM, Ed Leafe <ed@leafe.com> wrote:

>

> > On Jul 12, 2009, at 4:19 PM, Carey Gagnon wrote:

> >

> > > So even a static (for lack of a better phrase) drop down

> needs to be

> > > bound to the bizobj in order to be wrtten to the database on save?

> >

> > Yes. A control is just a dumb UI object. However, you can

> > enable data binding by setting two properties: DataSource and

> > DataField. These determine the object and property,

> respectively, that

> > the control is bound to. In the most typical case,

> 'DataSource' is the

> > same as the bizobj's DataSource (the form will figure this

> out at run

> > time), and 'DataField' is the column in the data that the control's

> > Value should be bound to. Just by setting those two properties you

> > transform a dumb UI control into a powerful data

> display/editing tool.

> >

> >

> > -- Ed Leafe

> >

> >

> >

> >

> >

[excessive quoting removed by server]

©2009 <lalong1@charter.net>