checkbox little question…
Archived from the Xataface Users forum.
xyloweb — Thu Oct 13, 2011 1:55 am
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`
manifold — Thu Oct 13, 2011 6:13 am
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…
ADobkin — Thu Oct 13, 2011 7:00 am
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.
xyloweb — Fri Oct 14, 2011 12:52 am
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.