This is put against the number module but also applies to any module using single checkboxes.

No matter what I set, I cannot get a single checkbox to respect the default value I set. If I check the checkbox as the default value and save, it doesn't appear checked when viewing the input form. If I go and edit the field, it shows the default value as checked!

Comments

yched’s picture

I know this has been reported in some other thread, but I can't seem to reproduce myself. 'Default value' for single checkbox work OK in my config.

Can you provide an export of your content type ? You need to enable content_copy.module (included in the CCK bundle). Please paste the result here, between < code > tags for better readability.

denney’s picture

Nevermind. This one appears to be my fault.

As I have the content type set as a user profile, I was expecting the default value to apply to all current user profile content items when I added the field.

The default value only applies to NEW user profiles (when people register). Shouldn't the default value apply automatically to already created nodes when adding the field?

yched’s picture

Status: Active » Closed (works as designed)

OK, then it'a a 'by design'.

'default values' only play for new nodes. For already existing nodes, if the box is not checked, then it means the author did mean to leave it unchecked, and we cannot mess with that.

I guess a feature request could be 'add a new field and provide a value to be used for all existing nodes', but that would be a different feature, which I'm not exactly sure how it should look like... something like mass-field-update... Would require a bit of careful thinking.

denney’s picture

Status: Closed (works as designed) » Active

Ah but... when you have already existing nodes and you ADD a checkbox field to that content type with a default value of CHECKED... shouldn't that mean the checkbox should be checked by default for the existing nodes?

As the checkbox wasn't a part of the content type when the author created the node, the author wouldn't know if the checkbox should be checked or unchecked meaning the default value should be set by default on already existing nodes regardless of if the author intends or not because the author is unaware of the fact that the checkbox even exists.

yched’s picture

yes, see the last part of my answer :-)

denney’s picture

Status: Active » Closed (works as designed)

Sorry about that. I didn't understand your answer correctly.

I have created a new feature request at http://drupal.org/node/167896.