On Friday 17 July 2009 11:33:54 am Carey Gagnon wrote:
> Ok, I have now got the drop down populating properly with all error message
> gone. Everything is saving to the database properly as well.
> Here's the appropriate section of the cdxml file:
>
> <dDropdownList sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'HAlign': 'Left',
> 'ColExpand': True}" Keys="[u&apos;0&apos;, u&apos;1&apos;, u&apos;2&apos;,
> u&apos;3&apos;]" rowColPos="(5, 1)" Choices="[u&apos;-Select-&apos;,
> u&apos;AL&apos;, u&apos;TX&apos;, u&apos;WA&apos;]"
> designerClass="controlMix" DataSource="clients"
> DataField="stateprov"></dDropdownList>
>
>
> I added the following line to the bizobj file which stopped the
> "String must be present in the choices"  error:
>
> self.DefaultValues = {"stateprov": "-Select-"}
>
> My Question now (looking at the cdxml snippet), is there anyway to display
> the full name of the state in the drop down list, but save the abbreviation
> to the database on self.Form.save()
>
> Thanks in advance
> Carey

Of course - this is Dabo after all.  

In general listCtrl controls have two 'ValueMode" s.  Using the 'key' 
or 'string'.  The default is to use string value in the choices list. But you 
can change it to "ValueMode = key"

So now you need to set the key and choices to match each other.

In your form select the dropdown control.  Copy your "Choices" ( I assume they 
are similar to ['CA','WA','TX',...]) and put it into the 'Keys'.  Now set the 
choices similar to ['California', 'Washington', 'Texas', ....]. Just make 
sure they match.  Next set the 'ValueMode' from 'string' to 'key'.  

Recall you will need to do something with the None value.  I always use '0' as 
my key for a None value.
Johnf





_______________________________________________
Post Messages to: Dabo-users@leafe.com
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/200907171159.55263.jfabi...@yolo.com

Reply via email to