Populate checkboxes
ru.meta - September 29, 2009 - 12:18
| Project: | Prepopulate |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
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?

#1
#2
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.