Preview doesn't keep the "decision settings", generates a bunch of warnings under E_ALL and always adds more choices.

We need to rewrite that damn form.

Comments

anarcat’s picture

Maybe we should look at the poll.module here.

anarcat’s picture

Status: Active » Fixed

Fixed in CVS by the horrible merge.

Status: Fixed » Closed (fixed)

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

polskikrol’s picture

Version: 6.x-0.1-beta2 » 6.x-1.x-dev
Status: Closed (fixed) » Active

This appears to be broken in 6.x-1.x-dev (May 27th commit).

Attempt to modify an existing decision, modify end date, and hit preview. I get extra random new choices and the date I entered is not retained. Would say this is still broken.

mwm’s picture

I think I've figured out what's wrong with preview form. decisions_form() tries to set the #default_value of the 'uselist' form element (for example) using the contents of $node->uselist, but this doesn't work during preview because the node hasn't been submitted yet. The form settings seem to be stored in $form_state['values']['settings'] during preview.

What I did to fix this locally is copy each element of that array to its corresponding $node variable inside the (otherwise useless) if statement at the top of the function. I tried just assigning the '#default_value' variables directly from their $form_state['values']['settings'] variables, but that array isn't populated during node editing.

I'd submit a patch, but my code is too heavily modified from the stock decisions module for that to be useful. I suspect there's a more standard and elegant way to fix this anyway.

I wasn't able to figure out why the preview itself isn't showing up correctly, but I suspect the cause is related (e.g. variables like $node->maxchoices might not be set during preview)