Hello,

Thank you for this great module! I want to create an Advanced Poll in two steps (with customfields). I'm using the module Multistep Nodeform to create these two steps. But if i want to save the node i get the following 4 error messages:

Notice: Undefined index: advpoll_choice in advpoll_validate_max_choices() (line 397 of /...../sites/all/modules/advpoll/advpoll.module).

Warning: Invalid argument supplied for foreach() in advpoll_validate_max_choices() (line 399 of /....../sites/all/modules/advpoll/advpoll.module).

The max number of choices is 1.

Please enter at least two choices.

Could somebody help me to solve this problem?

Many, many thanks!

CommentFileSizeAuthor
#5 2344007-1.patch522 bytesneerajskydiver
#3 2344007.patch466 bytesneerajskydiver

Comments

marco van bemmel’s picture

Issue summary: View changes
tripper54’s picture

Priority: Normal » Minor
neerajskydiver’s picture

Status: Active » Needs review
StatusFileSize
new466 bytes

The function "advpoll_validate_max_choices($element, &$form_state, $form)" in the module file was checking the choices, which was set to 2, now this is updated with the 1 in the attached patch which resolves this error.

tripper54’s picture

Status: Needs review » Needs work
Issue tags: -Advanced Poll, -Multistep Nodeform, -msnf

We can't just reduce the value to 1. The purpose of this check is to stop users creating polls with less than 2 choices.

We need to find out why the choices array is not properly populated when this check is run when used with this msnf module.

neerajskydiver’s picture

Status: Needs work » Needs review
Related issues: +#1848122: Some form field values don't persist across steps
StatusFileSize
new522 bytes

yes, choices array is not properly populated when used with msnf module.
the $form_state['input'] array is empty, their are similar issues with the msnf module.

but the $form_state['values'] array in not empty, this contains the data of the "advpoll_choice", so this is been applied in the attached patch, which resolves this issue.

tripper54’s picture

Status: Needs review » Fixed

Great, that seems to do the trick. Committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.