I'm using the new forms in CVS HEAD. I'm writing a module with custom user profile values (because I want more control over the forms than the profile.module gives. I'm simply hard-coding values into it for now.
When I make a checkbox, it's always selected, regardless of whether I unselect it or not before submitting. All other form types seem to work properly (saving the values for the users). When I change the type of the checkbox to 'textfield', it works (with a value of '1', which I can change, saving it propertly). Going back to 'checkbox', it fails again.
I have the following code:
<?php
function profile_custom_user($type, &$edit, &$user, $category = NULL) {
switch ($type)
{
case 'form':
return profile_custom_form($edit, $user, $category);
case 'categories':
return profile_custom_categories($user);
}
}
function profile_custom_form($edit, $user, $category)
{
// ...
// this doesn't work
$form['notABuyer']['profile_custom_buyer'] = array(
'#type' => 'checkbox', '#title' => 'Home Buyer',
'#default_value' => $edit['profile_custom_buyer'],
'#description' => 'If you are interested in buying a home, please check here.'
);
// this works
$form['questionBank2']['profile_custom_currentPosition'] = array(
'#type' => 'textfield', '#title' => 'Current Position',
'#default_value' => $edit['profile_custom_currentPosition'],
'#description' => 'Please tell us your current job position or title.'