Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have read through the code of the module and it appears to me that there is no way to prepopulate multiple values in a select list. The module just assign whatever is passed in $_GEt to #value of the corresponding element of the form. If one needs to populate multiple values in a select list the #value should be equal to something like that array('Value 1', 'Value 2'), but there is no way to pass this via $_GET.
Comment | File | Size | Author |
---|---|---|---|
#4 | prepopulate-multiselect-1468024-2.patch | 477 bytes | Venus Tang |
#1 | prepopulate-multiselect-1468024-1.patch | 472 bytes | alexpetrov |
Comments
Comment #1
alexpetrov CreditAttribution: alexpetrov commentedI have created a patch that fixes this issue. May be some people might find it useful.
With this patch a user can pass a comma separated list of values, e.g: /page?edit['submitted']['my_select']=Value1,Value2
Comment #2
zwhalen CreditAttribution: zwhalen commentedThis is exactly what I needed. Works perfectly.
Thanks!
Comment #3
Ken Hawkins CreditAttribution: Ken Hawkins commentedThis works well for us, too.
I don't see an immediate downside. Can we get this pushed up to the dev?
Comment #4
Venus Tang CreditAttribution: Venus Tang commentedThis patch will work with 7.x-2.0
Comment #5
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedPatch #4 applies and works fine for me, using 7.x-2.1 (just a little offset when applying the patch).