I have a pollfield CCK in my forum. On saving a forum poll, I get the following returned on the screen and nothing else:
{ "status": true, "data": "\x3cfieldset\x3e\x3clegend\x3eChoice #\x3cem\x3e1\x3c/em\x3e\x3c/legend\x3e\x3cdiv class=\"form-item\" id=\"edit-field-forum-poll-0-group-0-choice-wrapper\"\x3e\n \x3clabel for=\"edit-field-forum-poll-0-group-0-choice\"\x3eResponse: \x3c/label\x3e\n \x3cinput type=\"text\" maxlength=\"128\" name=\"field_forum_poll[0][group][0][choice]\" id=\"edit-field-forum-poll-0-group-0-choice\" size=\"60\" value=\"Yes\" class=\"form-text\" /\x3e\n\x3c/div\x3e\n\x3cdiv class=\"form-item\" id=\"edit-field-forum-poll-0-group-0-votes-wrapper\"\x3e\n \x3clabel for=\"edit-field-forum-poll-0-group-0-votes\"\x3eStarting votes count (optional): \x3c/label\x3e\n \x3cinput type=\"text\" maxlength=\"128\" name=\"field_forum_poll[0][group][0][votes]\" id=\"edit-field-forum-poll-0-group-0-votes\" size=\"10\" value=\"\" class=\"form-text\" /\x3e\n\x3c/div\x3e\n\x3c/fieldset\x3e\n\x3cfieldset\x3e\x3clegend\x3eChoice #\x3cem\x3e2\x3c/em\x3e\x3c/legend\x3e\x3cdiv class=\"form-item\" id=\"edit-field-forum-poll-0-group-1-choice-wrapper\"\x3e\n \x3clabel for=\"edit-field-forum-poll-0-group-1-choice\"\x3eResponse: \x3c/label\x3e\n \x3cinput type=\"text\" maxlength=\"128\" name=\"field_forum_poll[0][group][1][choice]\" id=\"edit-field-forum-poll-0-group-1-choice\" size=\"60\" value=\"No\" class=\"form-text\" /\x3e\n\x3c/div\x3e\n\x3cdiv class=\"form-item\" id=\"edit-field-forum-poll-0-group-1-votes-wrapper\"\x3e\n \x3clabel for=\"edit-field-forum-poll-0-group-1-votes\"\x3eStarting votes count (optional): \x3c/label\x3e\n \x3cinput type=\"text\" maxlength=\"128\" name=\"field_forum_poll[0][group][1][votes]\" id=\"edit-field-forum-poll-0-group-1-votes\" size=\"10\" value=\"\" class=\"form-text\" /\x3e\n\x3c/div\x3e\n\x3c/fieldset\x3e\n\x3cfieldset\x3e\x3clegend\x3eChoice #\x3cem\x3e3\x3c/em\x3e\x3c/legend\x3e\x3cdiv class=\"form-item\" id=\"edit-field-forum-poll-0-group-2-choice-wrapper\"\x3e\n \x3clabel for=\"edit-field-forum-poll-0-group-2-choice\"\x3eResponse: \x3c/label\x3e\n \x3cinput type=\"text\" maxlength=\"128\" name=\"field_forum_poll[0][group][2][choice]\" id=\"edit-field-forum-poll-0-group-2-choice\" size=\"60\" value=\"\" class=\"form-text\" /\x3e\n\x3c/div\x3e\n\x3cdiv class=\"form-item\" id=\"edit-field-forum-poll-0-group-2-votes-wrapper\"\x3e\n \x3clabel for=\"edit-field-forum-poll-0-group-2-votes\"\x3eStarting votes count (optional): \x3c/label\x3e\n \x3cinput type=\"text\" maxlength=\"128\" name=\"field_forum_poll[0][group][2][votes]\" id=\"edit-field-forum-poll-0-group-2-votes\" size=\"10\" value=\"\" class=\"form-text\" /\x3e\n\x3c/div\x3e\n\x3c/fieldset\x3e\n" }
Is this an ajax return?
Core poll is disabled.
ajax_poll is installed, but not enabled.
It doesn't happen if a forum post is created without a pollfield.
Comments
Comment #1
dunx CreditAttribution: dunx commentedSorry, this may be a duplicate of http://drupal.org/node/591696
I'm not 100% sure about terminology, but is what I'm seeing JSON? Is so, it occurred after a form error and adding a further option, so do delete us duplicate if this is the case.
P.S. Also just noticed that the poll is actually created okay.
Comment #2
dunx CreditAttribution: dunx commentedOkay, solved for me. It is down to the above AHAH error, but here's a specific solution for pollfield used within advanced_forum.
Here's the full solution ('cos I hate seeing solutions that say "you need this code", that don't tell you where to put it). Create yourself a helper module under /sites/all/module/ where all your other contrib modules are (you just need a helper.info and helper.module file - Google for Drupal module creation or just copy from another module you've already downloaded). Then create a new hook_form_alter function in your helper.module file to deal with this specific problem. Naturally your module doesn't need to be called "helper".
Setting the #action to null, effectively means #action becomes the same as your page URL, so for example if you're posting from http://www.mysite.com/node/add/forum/179, #action will become that. Works fine when editing the node too.
Comment #3
bryan kennedy CreditAttribution: bryan kennedy commentedDunx, thanks for posting your temp. solution.
It seems like this is still an issue with drupal core's AHAH handling. I will look into whether there is a way to put your workaround directly into the pollfield code until the Drupal core issue is fixed.
Comment #4
dunx CreditAttribution: dunx commentedAgreed; it's a core issue, which hasn't been fixed for a long time and is causing pollfield to fail in this one scenario. Whilst it is only one scenario, it's not one that a site developer may come across, so may first hit site users. If there's a possibility of a pollfield solution, then that would be both fab and groovy.
Comment #5
bryan kennedy CreditAttribution: bryan kennedy commentedYeah, I agree with you dunx. I'll look into a workaround.
Comment #6
queryblitz CreditAttribution: queryblitz commentedGreat module... any progress on this?