I’m trying to set a #default_value on my D7 form, but it’s not working… This is my array:
'thema_30fdc789-1453-4efa-93d6-123cab52206e' =>
array
'#type' => string 'checkboxes' (length=10)
'#title' => string 'What kind of fiches??' (length=42)
'#options' =>
array
'create' => string 'New fiches' (length=13)
'update' => string 'Updated fiches' (length=13)
'delete' => string 'Deleted fiches' (length=13)
After editing this form with this line:
$form['thema_30fdc789-1453-4efa-93d6-123cab52206e']['#default_values']=
array('create' => 'Nieuwe fiches', 'update' => 'Update fiches', 'delete' => 'Delete fiches');
I get this var_dump:
'thema_30fdc789-1453-4efa-93d6-123cab52206e' =>
array
'#type' => string 'checkboxes' (length=10)
'#title' => string 'What kind of fiches??' (length=42)
'#options' =>
array
'create' => string 'Newfiches' (length=13)
'update' => string 'Updated fiches' (length=13)
'delete' => string 'Deleted fiches' (length=13)
'#default_values' =>
array
'create' => string 'Newfiches' (length=13)
'update' => string 'Updated fiches' (length=13)
'delete' => string 'Deleted fiches' (length=13)
So, the hook_form_alter did his job. Nevertheless, the checkboxes aren’t checked on when reloading the page… What do I need to do to make sure they are checked on?
Nevermind. I found it myself. I needed to adjust the string to this: