Page 1 of 1

checkbox group

PostPosted: Fri May 23, 2008 4:54 am
by Jean
Hello Steve,
I don't understand I have in my fields.ini
Code: Select all
[type_computers]
group = machines
widget:label = Ordinateurs
widget:type = checkbox
vocabulary = ordinateurs


and in my valuelists.ini :

Code: Select all
[ordinateurs]
__sql__ = "SELECT ID, name from glpi_type_computers ORDER BY name"


But, although I have several items in my table, I have only one checkbox beside the label "ordinateurs".
I tried all kinds of tests without success.
Would you have a hunch about this ? My version is the 0.7.1
Thank you
Best regards
Jean

PostPosted: Fri May 23, 2008 7:07 am
by shannah
What data type is the column type_computers? In order to do a group of checkboxes, it needs to be a varchar or text (not a numeric type).

-Steve

PostPosted: Fri May 23, 2008 7:52 am
by Jean
Thank you very much Steve, they are numeric.

PostPosted: Fri May 23, 2008 8:39 am
by shannah
Just to clarify. The valuelist can have numeric values. Just that the field that is edited with a checkbox group cannot be numeric. This is because if multiple values are selected, Xataface will store all of the values in the field separated by line breaks. This only works for varchar and text fields.

PostPosted: Mon May 26, 2008 5:31 am
by Jean
Thank you Steve for your precisions. I think my problem comes from something else because I changed my pair ID/name in my query into name/name and add
Code: Select all
widget:separator ="
"
in the fields.ini without any change. I still have only on checkbox near my label.
Code: Select all
group = machines
widget:label = Ordinateurs
widget:type = checkbox
vocabulary = ordinateur
widget:separator="
"

and in my valuelists.ini
Code: Select all
__sql__ = "SELECT name, name from glpi_type_computers ORDER BY name"

I tried too
Code: Select all
SRV= Serveur
PC = PC de Bureau
ST = Station de Travail
PL = Platine
PORT = Portable
PKT= Pocket PC

without any change.
Jean

PostPosted: Mon May 26, 2008 8:59 am
by shannah
Hi Jean,

It isn't the valuelist you need to be looking at here. It is the type_computers column. What is the data type for this field? Is it a varchar, an int, or something else?

PostPosted: Mon May 26, 2008 11:33 pm
by Jean
Sorry Steve, I feel stupid :wink: