I've tried to populate user roles from url
/admin/user/user/create?edit[account][roles]=7
and found that #default_value replaced with string. Also I tried to use
edit[account][roles][]=7
with no success.
The solution I found is to replace
$form['#default_value'] = $getslice;
with

if (is_array($form['#default_value'])) {
  $form['#default_value'][] = $getslice;
} else {
  $form['#default_value'] = $getslice;
} 

Is there better way?

Comments

ru.meta’s picture

Title: Populace checkboxes » Populate checkboxes
MadOverlord’s picture

With taxonomy select boxes (not checkboxes), at least, you can do multiple select:

node/add/product?edit[taxonomy][3][]=11&edit[taxonomy][3][]=10

and single select like this:

node/add/product?edit[taxonomy][3]=11

I don't know if this will be helpful for checkboxes though.

jbrauer’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing D6 issues as it's no longer supported.