[support] CCK Problem with Option Widget
Alex Tang
altitude at funkware.com
Fri Mar 28 13:49:58 UTC 2008
Hello Davide,
The problem you're having is with how you must define the parameters in
your field and widget.
When defining an option widget (single checkox or radio button), the
"Label" field is not used. The instructions for the field (at the top)
say (in english):
For a 'Single on/off checkbox' widget, define the 'off' value first,
then the 'on' value in the *Allowed values* section. Note that the
checkbox will be labeled with the label of the 'on' value.
So:
* You must enter two (and only two) parameters in the "Allowed
Values list:" text area
* the format of the lines must be "value|label", (and the label of
the first line is effectively ignored).
For example, say you wanted:
* A simple "Yes/No" question for the user
* The value returned stored in the database to be "1" or "0",
* you want the label to be "Yes" (and the user must select "yes" in
order for the value to be stored to be 1),
You should put the following in the Allowed Values section:
0|No
1|Yes
The weirdness about this format has to do with the way the module author
wanted you to be able to switch the field type from radio/checkbox to
list of radio buttons without having to change anything except for the
"Widget" type in the CCK field definition.
For more information about this, see http://drupal.org/node/115026, and
the comments by jsenich (comment #15), and yched (comment #16).
...alex...
Davide Michel 'ZioBudda' Morelli wrote:
> Hi all, I have a problem with CCK (1.6-1) on my new Drupal installation
> (5.7).
>
> I can create a Text Single sign on/off field (checkbox or radio button),
> but with some errors:
>
> 1) The label is not associated to the field. See the two image attached.
>
> 2) When I check the field, my check is not stored in the DB so when I
> re-edit the node I see that the field is not checked.
>
> Any help ?
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080328/2fb593ad/attachment.htm
More information about the support
mailing list