Hi,

When I build a CCK nodefield and insert default behaviour, I suspect this default behaviour is inherited in every node instance I make from this nodetype, right?
If this is espected behaviour there is a bug in the module.

When I edit a node, and click on pollfield, I see a clean pollfield with not any default setting set in the Nodetype CCK_field settings (admin/content/types). Also The question field is blank in the node, while on the nodetype I filled in a question title.

Preferred behaviour is having a default question in a pollfield on nodetype basis, and if you want for some reason another question on a specific node, than change this on node level.

Thanks for going into this!
Greetings, Martijn

Comments

I think this is almost the same question? http://drupal.org/node/688172
But still not clear whether default values in nodetype with cck_polefield should be shown with nodes of that nodetype. I think it should, that's why I filed this bugreport.
greetings, Martijn

Hi, could it be that pollfield only works for newer nodes? That means that already in the system available nodes do not get default settings?
EDIT. It is true. So now the problem is the already available nodes.
How to get pollfield values in the existing nodes also? May be mysql query?

Greetings, Martijn

Title:CCK nodetype pollfield settings not inherit in a node instanceCCK nodetype pollfield settings not inherit in a already made node instance

Changed title.
Edit, may be related to http://drupal.org/node/200359 and http://drupal.org/node/187599#comment-883018
greetings, Martijn

Hi, May be something like this is possible for pollfield: http://benbuckman.net/tech/10/01/drupal-automating-cck-field-creation-up...
Am I the only one with this problem? How do others add cck pollfield to an already existing node?
Greetings, Martijn

Category:bug» support

May be I am thinking to deep..and should I do a MYSQL Query.
This is current database situation related to my pollfield:

CREATE TABLE IF NOT EXISTS `content_type_weblinks` (
  `vid` int(10) unsigned NOT NULL default '0',
  `nid` int(10) unsigned NOT NULL default '0',
  `field_bar_terras_question` text,
  `field_bar_terras_active` int(11) default '0',
  `field_bar_terras_runtime` int(11) default '0',
  `field_bar_terras_choice` text,
  `field_bar_terras_votes` int(11) default '0',
  `field_bar_terras_anonymous` text,
  `field_bar_terras_poll_features` text,
  PRIMARY KEY  (`vid`),
  KEY `nid` (`nid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `content_type_weblinks`
--
INSERT INTO `content_type_weblinks` (`vid`, `nid`, `field_bar_terras_question`, `field_bar_terras_active`, `field_bar_terras_runtime`, `field_bar_terras_choice`, `field_bar_terras_votes`, `field_bar_terras_anonymous`, `field_bar_terras_poll_features`) VALUES
(220, 220, NULL, 0, 0, NULL, 0, NULL, NULL),
(221, 221, 'Hoe is de kwaliteit van het terras?', 1, 0, 'a:1:{i:0;a:2:{s:6:"choice";s:0:"";s:5:"votes";s:0:"";}}', 0, 'anon_non', 'a:3:{s:16:"CancelVote_Allow";s:1:"1";s:12:"ResultsAllow";s:1:"0";s:8:"PollType";s:1:"1";}'),
(222, 222, NULL, 0, 0, NULL, 0, NULL, NULL),

I want preferrably automated, the values from 221 in 220 and 222..

greetings, Martijn

Priority:Normal» Major

If this is still an issue it is major. I will look into it later.

Hi, yes this is still an issue. Thanks for going into it.
greetings, Martijn

Category:support» bug
Status:Active» Needs review
Issue tags:+defaults

Hey Summit, I've been doing some work on the dev branch, and I think that the default values are working properly. I was able to add a pollfield, define defaults on in the manage fields system, and then create nodes with those defaults.

Try the latest dev release and let me know if you see any difference.

Title:Pollfield default settings not inherited by nodesPollfield settings not inherited by nodes

Hello,

No patch to review so setting back to active.

Tested dev, but the defaults are not taken into account in node instances.

For example, I set a poll to active, and set some default values in the manage fields screen for the entire content type.

But when I go to the node, and edit it, the poll always shows as closed, and none of my questions appear.

Title:CCK nodetype pollfield settings not inherit in a already made node instancePollfield default settings not inherited by nodes
Status:Needs review» Active

Title:Pollfield settings not inherited by nodesPollfield default settings not inherited by nodes

Hey giorgio79, thanks for helping to figure out this bug.

I can't reproduce this bug anymore with the latest dev release (updated June 14, 2011 21:30). Here is what I did. If you still can produce the error, please post your step by step path for re-creating this issue.

1. Go to the manage fields page for your content type. http://www.example.com/admin/content/types and click manage fields on your desired content type.
2. Create a new field with the pollfield field type.
3. Now you are on the pollfield's settings page. Click "default value". Then click "Pollfield".
4. Fill out your default values in the question and choice fields. Select the settings you desire. Click "Save field settings".
5. Create a new node using the content type you just modified.
6. Click on the pollfield fieldset for the field you just created. You should be able to see your default values in that form.

When I follow exactly those steps the default values work for me. If you are doing something different, or if I am missing a step, let me know.

Much appreciated Bryan!
I just followed your steps and those worked for me fine too.

It does not work though for existing nodes! :)

Is there any way to get this to work for existing nodes? Nodes that were created before the pollfield was added for the content type.

If not that is fine as well, I will just check what gets saved, and do a VBO Modify Node Fields action for existing fields.

Title:Pollfield default settings not inherited by nodesPollfield default settings not inherited when editing existing nodes
Assigned:Unassigned» bryan kennedy

Aha! I see the bug now. The defaults fill out just fine if you are doing a node/add. However, the defaults are empty and even the number of choices is wrong if you edit an existing node. I'll look into a fix for that.

Giorgio79, I've got about half of a solution working on my local branch now. I want to do some more testing before I push it to dev, but I should have a fix to this issue by the end of the weekend.

Thanks Bryan, sounds lovely. Look forward to testing it.

Status:Active» Fixed

I've committed some new code to the dev branch that should fix this issue. I'd appreciate some people trying it to confirm that the latest dev (as of this comment) resolves the default values problem.

**caveat** - there are likely to still be some issues with defaults and multiple pollfields per content type / node, related to this other open issue #1168408: Choices fields lost when editing a node with more than 2 pollfields. Fixing and testing that issue is my next priority.

Actually I am noticing that the packaged dev download from the project page only updates twice a day. So the best way to get this code is to clone the git branch, 6.x-1.x. Just an FYI.

Thanks Bryan, I can confirm it is fixed, much appreciated.

Status:Fixed» Active

Actually no, it still exists.

I cleared cache several times but default values still do not pull in. (In the previous post, I confused screens, and was looking at the actual poll field default values, not on the node screen...)

Strange, default values are sticking around for me in the latest dev release. Can you describe the exact steps you used? Maybe I am not testing the same workflow that you are using. It would be great if you could talk through your version history. Maybe there's something in data from 6.x-1.13 moving to the new 6.x-1.x-dev version.

Here's what I did. If you are seeing something different, can you spell out the exact steps?

  1. Create a content type and add some basic text fields.
  2. Add a few nodes with that content type using some dummy content.
  3. Add a pollfield to that content type, defining some defaults for the question, choices, and settings.
  4. Edit one of my existing nodes. The pollfield is present with the defaults I supplied.
  5. Edit one of my existing nodes, and change some of the data in the pollfield section from the default and saved the node. Now, the defaults are ignored for this node of course, since I've edited the content.
  6. Add a new node using that same content type. The defaults I supplied in the pollfield are present.

I might set up a test site to demonstrate the functionality, that way we could all look at the same thing...later this week.

Thanks Bryan, testing currently.

The workflow you describe works for me for a default content type like Page.

But for one of my custom content type it does not. I dont quite understand it yet, but still checking and trying to make it reproducible.

PS : Yes, I now checked in two custom content types, and it does not work for existing nodes. For page content it works :)

What is custom about those content types? The workflow I described works for me with a content type I created from scratch, not the "page" content type? I need to know if this is the result of a pollfield bug (ie. are you adding more than one pollfield?) or is it some other custom field interaction. Any more information "custom" would be very helpful.

Thanks Bryan, will be checking it further. Perhaps others who reported it will be checking it as well.

Hey Bryan,

I double checked this, but this only works for me with Page, a default content type.

For content types that I created, they get a table in the db called
content_type_mycustomname
and they get columns added like this
field_poll_question
field_poll_active
field_poll_runtime
field_poll_choice
field_poll_votes
field_poll_anonymous
field_poll_features

Now, for existing nodes these are all null.

I cannot check what happens for "Page" since "Page" does not have a content_type_page table.

I am still looking for ways to replicate this, but if it works for you I am not sure what the issue could be.

If you could tell me which function is responsible for this, I could backtrace it with devel.

Another thing I am noticing is that for each page node the default values show nicely, but I have to save an existing node to make a poll field with default to active appear.

Hello Bryan,

Just gave a whirl to a clean drupal install with pollfield, and I can confirm it does not work. Here are the steps to reproduce:

1. Create test content type
2. Add a dummy integer field
3. Create a test content node
4. Edit test content type, add pollfield, with default values : Allowed, 3 questions, allow anonymous
5. Go to edit the test content node created in step 3. Pollfield does not show the default values.

It does work, if I create a new test content node AFTER adding pollfield :)

I also noticed the following
6. If I create a new test content now, default values show on node edit screen. When I click on save, the pollfield does not appear
7. Go to edit, and all the default values are gone. They were not saved for some reason.

yeah, the same for me, would be great to get this sorted out.
2 fields on "forum" content type, if already saved nodes without pollfield are viewed, the options are blank.

also, I don't know if I should open a new bug, but:

  1. user 2 creates a node (pollfield empty)
  2. user 1 edits node (adds some pollfield data), saves node
  3. the title is displayed, but the radios/checkboxes do not show up on the node.