I have a webform with a multiselect box. I want to use the prepopulate module to allow people to set the default value in the URL. The following works, but it only supports selecting one value:


Other places have suggested using URLs like the following, but that doesn't work for either one URL or multiple:


When I pass multiple URL parameters, it just takes the last one, so Value2 is selected in the following example rather than Value and Value2:


As a workaround, I could define custom GET parameters for each item in the webform using the webform module, but I was hoping to make everything consistent, and as far as I can tell, webform doesn't support GET parameters that use array notation (as per http://drupal.org/node/824606), so neither of the following works as the default in the webform module:


Thanks for the help!

1 Answer 1


I have just read through the code of Prepopulate module, and it seems that as for now it doesn't support the feature you're after. The prepopulate module just assigns whatever is passed as a parameter to #value of the corresponding form element. To have multiple items selected you need to assign to #value something like this: array('Value 1', 'Value 2'); but there is no way you can pass this via parameters.

THe possible workaround is to hack the module code. Add the following code on the line #78 of the file - prepopulate.module

  if($form['#type'] == 'select' && $form['#multiple'] == TRUE) {
    $requestslice = explode(',', $requestslice);

just before this line:

  $form['#value'] = $requestslice;

This change will allow you to pass multiple values as a comma separated list, for example:


I have just created a patch for for the prepopulate module that implements this thing, you can find it here:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.