Page 1 of 1

checkbox little question...

PostPosted: Thu Oct 13, 2011 1:55 am
by xyloweb
Hi,

Why my list is displaying '0' instead of the associated value : 'disable' ?
'enable' works fine.

My 'fields.in'
Code: Select all
[vtu_enable]
   vocabulary = vtu_enable
   widget:label = "VerbaTool autorisé"
   widget:description = "Autoriser ou interdire l'utilisation de VerbaTool"
   widget:type = checkbox


And my valuelists.ini
Code: Select all
;; Encodage UTF-8

[vtu_enable]
0=disalbe
1=enable

Re: checkbox little question...

PostPosted: Thu Oct 13, 2011 6:13 am
by manifold
You have 'disable' misspelled in your valuelist... don't know if that is how you have it spelled in your actual list, or just mis-typed it here...

Re: checkbox little question...

PostPosted: Thu Oct 13, 2011 7:00 am
by ADobkin
How is the vtu_enable field defined in your database? Normally checkbox widgets are used with boolean (tinyint) fields where 1 indicates checked and 0 not checked, but your valuelist should display the associated value in your list view.

Re: checkbox little question...

PostPosted: Fri Oct 14, 2011 12:52 am
by xyloweb
My 'vtu_enable' field is tinyint 1 unsigned zerofill.

valueslists doesn't work so I wrote a customized display delegate
Code: Select all
   function vtu_enable__display($record) {
      return $record->val('vtu_enable') ? "autorisé" : "interdit";
   }

and it works fine.