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
Comment #1
Summit CreditAttribution: Summit commentedI 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
Comment #2
Summit CreditAttribution: Summit commentedHi, 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
Comment #3
Summit CreditAttribution: Summit commentedChanged title.
Edit, may be related to http://drupal.org/node/200359 and http://drupal.org/node/187599#comment-883018
greetings, Martijn
Comment #4
Summit CreditAttribution: Summit commentedHi, 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
Comment #5
Summit CreditAttribution: Summit commentedMay be I am thinking to deep..and should I do a MYSQL Query.
This is current database situation related to my pollfield:
I want preferrably automated, the values from 221 in 220 and 222..
greetings, Martijn
Comment #6
bryan kennedy CreditAttribution: bryan kennedy commentedIf this is still an issue it is major. I will look into it later.
Comment #7
Summit CreditAttribution: Summit commentedHi, yes this is still an issue. Thanks for going into it.
greetings, Martijn
Comment #8
bryan kennedy CreditAttribution: bryan kennedy commentedHey 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.
Comment #9
giorgio79 CreditAttribution: giorgio79 commentedHello,
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.
Comment #10
giorgio79 CreditAttribution: giorgio79 commentedComment #11
bryan kennedy CreditAttribution: bryan kennedy commentedHey 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.
Comment #12
giorgio79 CreditAttribution: giorgio79 commentedMuch 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.
Comment #13
bryan kennedy CreditAttribution: bryan kennedy commentedAha! 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.
Comment #14
bryan kennedy CreditAttribution: bryan kennedy commentedGiorgio79, 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.
Comment #15
giorgio79 CreditAttribution: giorgio79 commentedThanks Bryan, sounds lovely. Look forward to testing it.
Comment #16
bryan kennedy CreditAttribution: bryan kennedy commentedI'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.
Comment #17
bryan kennedy CreditAttribution: bryan kennedy commentedActually 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.
Comment #18
giorgio79 CreditAttribution: giorgio79 commentedThanks Bryan, I can confirm it is fixed, much appreciated.
Comment #19
giorgio79 CreditAttribution: giorgio79 commentedActually 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...)
Comment #20
bryan kennedy CreditAttribution: bryan kennedy commentedStrange, 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?
I might set up a test site to demonstrate the functionality, that way we could all look at the same thing...later this week.
Comment #21
giorgio79 CreditAttribution: giorgio79 commentedThanks 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 :)
Comment #22
bryan kennedy CreditAttribution: bryan kennedy commentedWhat 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.
Comment #23
giorgio79 CreditAttribution: giorgio79 commentedThanks Bryan, will be checking it further. Perhaps others who reported it will be checking it as well.
Comment #24
giorgio79 CreditAttribution: giorgio79 commentedHey 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.
Comment #25
giorgio79 CreditAttribution: giorgio79 commentedIf you could tell me which function is responsible for this, I could backtrace it with devel.
Comment #26
giorgio79 CreditAttribution: giorgio79 commentedAnother 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.
Comment #27
giorgio79 CreditAttribution: giorgio79 commentedHello 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.
Comment #28
janis_lv CreditAttribution: janis_lv commentedyeah, 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: