我试图让 Drupal 表单显示复选框,但我似乎没有运气。
function multi_reg_pagecreate() {
$multi_reg_checkbox = multi_reg_checkbox();
print_r($multi_reg_checkbox);
$form['multi_reg_checkbox'] = array(
'#type' => 'checkboxes',
'#options' => $multi_reg_checkbox,
'#description' => t('Register for multiple events here')
);
return $form;
}
数据格式如下:
Array ( [22] => Test Event Reg [23] => Test Event Reg 2 )
这似乎类似于示例中所说的:
https://api.drupal.org/api/drupal/developer%21topics%21forms_api_reference.html/6#checkbox
我做错了什么?
编辑:
我在显示的页面上看到了这个:
<form id="multi-reg-pagecreate" accept-charset="UTF-8" method="post" action="/domain/multiple-registration">
<div>
<div class="form-item form-type-checkboxes form-item-multi-reg-checkbox">
<label for="edit-multi-reg-checkbox">Events </label>
<div id="edit-multi-reg-checkbox" class="form-checkboxes"></div>
<div class="description">Register for multiple events here</div>
</div>
<input type="hidden" value="form-t_KSPV9ULp71yMEUHCtDUKV4R3M18M4ie2_M6cj-ZVU" name="form_build_id">
<input type="hidden" value="RzzEFjyCz29CjH9F9PAB5UV9Xq9VBCx8mTY_HppLfiA" name="form_token">
<input type="hidden" value="multi_reg_pagecreate" name="form_id">
</div>
</form>