Re: [dabo-users] Very Simple dropdownlist

Author: Carey Gagnon

Posted: 2009-07-12 at 17:19:56

Larry;

I'm not sure I understand. In the Class Designer I set the

datatfield to stateprov for the drop down list. I assumed it passed what

ever was selected in the drop down to the database on save.

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?

Thanks for your reply

Carey

On Sun, Jul 12, 2009 at 4:01 PM, <lalong1@charter.net> wrote:

> Hello Carey,

>

> When you instantiated the dropdown did you bind it to the bizobj?...ie

> something like...

> statesdropdown =3D your_dDropdownList(self, DataSource =3D bizobje=

ct,

> DataField =3D "state_id_field")

>

> Larry Long

>

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

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

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

> > Sent: Sunday, July 12, 2009 2:31 PM

> > To: dabo-users@leafe.com

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

> >

> > My apologies if this goes out twice. I posted to the nabble

> > forum before realizing I needed to subscribe to the mailing list.

> >

> > ## As Posted On Nabble ##

> >

> > 1st off, thanks to the developers of dabo. I'm a n00b to

> > python, wxpython and dabo. With the help of this forum and

> > the step by step guide I have managed to get everything in

> > said guide working as expected. I've even managed some simple

> > modifications as I learn dabo et al. There's one modification

> > I just can't wrap my head around that I will want to use once

> > I start developing my own app.

> >

> > Here's the problem. In the step by step the input field for

> > stateprov is currently set to a dTextBox. I would like to

> > change this to a dDropdownList.

> > I don't want to set up another db table just to do this (I've

> > got populating a drop down from the db down no problem). I

> > just want a static drop down list that will add the selected

> > state from the drop down list to the stateprov field of the

> > client table of the database (MySQL) on save. (one mod I

> > managed was an Add Client form)

> >

> > I've looked at the test in the uiwx/dDropdownList.py file and

> > have created the following via the CD. The code is located in

> > the ClientAddForm-code.py

> > file:

> >

> > def afterInit(self):

> > #def initProperties(self): ## Commented out

> > locations =3D ({"state": "Ak", "iid": 1},

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

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

> >

> > choices =3D []

> > keys =3D {}

> > for location in locations:

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

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

> > self.Choices =3D choices

> > self.Keys =3D keys

> > self.ValueMode =3D "key"

> >

> > The drop list with choices displays in the form no problem,

> > but when I save to the database the selection is not added to

> > the stateprov field.

> >

> >

> > H E L P ! ! !

> >

> > Thanks in advance

> > Carey

> >

> >

> > --- StripMime Report -- processed MIME parts --- multipart/alternative

> > text/plain (text body -- kept)

> > text/html

> > ---

> >

[excessive quoting removed by server]

©2009 Carey Gagnon