Closed (duplicate)
Project:
Drupal core
Version:
x.y.z
Component:
upload.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
20 Dec 2005 at 21:14 UTC
Updated:
23 Dec 2005 at 00:09 UTC
Jump to comment: Most recent file
Comments
Comment #1
chx commentedNow you wait, you tell me that form choices patch broke upload? Damn!
Comment #2
m3avrck commentedThis also caused problems with project module too, getting illegal choice a lot as well.
Comment #3
m3avrck commentedI think this might be related to this issue: http://drupal.org/node/42008
Comment #4
matt westgate commentedHow to Reproduce
Upload a file to a node and hit submit. Then edit the node again and uncheck the 'list' option. The form will not validate and throw an "Illegal choice in ." error. In otherwards you currently have to list the files because the error prevents anything else.
The Problem
Line 153 in
_form_validate()expects the keys of the$elements['#value']array to be the index of the file number to validate (i.e., validate the first file, second file, etc). Currently the values (not the keys) in$elements['#value']contains the information_form_validate()is looking for.The Fix (I hope)
$elements['#value']is being populated in_upload_form(), so we just need to swap around the values there.Comment #5
hunmonk commentedpretty sure this isn't the problem. it's a bit convoluted, but if you look here in form.inc:
i *think* what's happening is that for the checkboxes form element itself (prior to expansion), there is no 'return_value', but there can be a 'default_value'. this seems to be causing $form['#value'] to be set to an incorrect array for the checkboxes form element in the particular case where all checkboxes are unchecked.
can anyone else confirm this logic?
Comment #6
matt westgate commentedHere's an updated patch which also resolves some of the larger checkbox issues hunmonk is referring to. Although there may be bigger patch coming which cleans up checkbox logic even more.
Comment #7
m3avrck commentedAs instructed by chx this is a duplicate of: http://drupal.org/node/39179