On 25 Dec 2005, at 6:12 AM, Karoly Negyesi wrote:
b) we change #value instead to be a list of selected values, like in multiselect. The code change in form.inc for this is minimal:
if ($form['type'] == 'checkboxes') { $edit = array_keys(array_filter($edit)); }
I like this one much better. The only problem is that somewhat it differs from what you get from HTML -- but this is the information you actually need. I like this approach too , but I don't really like the idea of adding type specific code into form_builder itself. The function is already too hard to comprehend as it is.
why not do : if (function_exist($form['#type'] . '_value')) { ${$form['#type'] . '_value'}($form); } else { $form['#value'] = $form['#default_value']; } ------------- function checkboxes_value(&$form) { $value = array(); foreach ($form['#default_value'] as $key) { $value[$key] = 1; } $form['#value'] = $value; } We never know if some other element might have a similar problem in the future. and at least now we would be able to fix it for just that element without having to resort to changing form_builder. -- Adrian Rossouw Drupal developer and Bryght Guy http://drupal.org | http://bryght.com