Alter checkboxes values in a webform How can I alter the key/value items of a checkboxes component in a webform?
I've followed this answer and I successfully altered a select list component for both render and submission.
I'm trying to do the same with a multiple choice component, but although the form is rendered correctly, the values are not saved on submission.
This is my code:  

function my_form_webform_client_form_30_alter (&amp;$form, &amp;$form_state) {
    $form = mycustom_form($form);
}

function mycustom_form($form){  
     $form['#validate'][] = 'mycustom_webform_validate_form';
     $form['#submit'][] = 'mycustom_webform_submit';
     dpm($form['submitted']['code']['#options']); // ('0'=&gt;'a value', '1'=&gt;'another value');
     $codes = array('foo', 'bar'); 
     foreach ($codes as $key =&gt; $value) {
        $form['submitted']['code']['#options'][$value] = $value;
     } 

return $form;
}

function mycustom_webform_validate_form($form, &amp;$form_state) {
dpm($form_state['values']['submitted']);
// selecting all checkboxes I get all the four values
}

function mycustom_webform_submit($form, &amp;$form_state) {
  drupal_set_message('&lt;pre&gt;' . print_r($form_state, true) . '&lt;/pre&gt;');
// only 'a value' and 'another value' are submitted
}


UPDATE
I even tried to add some values to the initial form and manipulate them programmatically.
The submission result is like no manipulation was done.
I update my code for a better explanation.  

UPDATE 2
I've tried dumping the submitting form.
I updated my code with the results.  

UPDATE 3
I confirm that removing the "Multiple" flag from the component, causes the issue to be fixed.
Unfortunately I need a multiple answer, so I can't remove it.  

UPDATE 4
This is another solution I'm trying, using hook_webform_select_options_info():  

function mycustom_webform_select_options_info() {
    $items = array();

   if (function_exists('_mycustom_users_options')) {
        $items['code'] = array(
        'title' =&gt; t('User codes'),
        'options callback' =&gt; '_mycustom_users_options',
      );
 }

  return $items;
}

function _mycustom_users_options() {
  $output = array();
  $codes = mycustom_user_codes(); // &lt;- these values are based on logged user
  foreach ($codes as $key =&gt; $value) {
    $output[$value] = $value;
  }
  return $output;
}  

function mycustom_user_codes() {
      $result = // a db query based on user id;
      while($usercode = db_result($result)){
         $output[] = $usercode;
      }

      return $output; // array({[0] =&gt; 'a value', [1] =&gt;'another value'})
}
I've just tested the following code out locally and it "works", with the exception that when I view the submission results as an administrator, I see the original keys and not the keys that were altered when the form was displayed (which is what I would expect).

function my_custom_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'webform_client_form_12') { // yours is different
    // 'options' is the component name for a multiple-checkbox component.
    $form['submitted']['options']['#options'] = array(
      1 =&gt; 'Foo',
      2 =&gt; 'Bar',
    );

    $form['#submit'][] = 'my_custom_submit';
  }
}

function my_custom_submit(&amp;$form, &amp;$form_state) {
  dpm($form_state);
}


dmp($form_state) showed me that the checkbox I had picked was indeed the one that was checked, and when I look in the database in webform_submitted_data I can see that the record  shows the proper value that I checked:

nid sid cid no data
12  12  2   0  2


where data = 2 shows the checkbox that I picked in my altered options (I picked "Bar").

Since the subsequent submission display is going to show the keys as they currently exist, it's showing me that I picked the original value for option #2. If I change that to "apples" in the component and then refresh the submission, it shows the 2nd option as "apples". So I could follow this up with another hook_webform_submission_render_alter() or hook_webform_submission_load() to change the options being displayed on submission view so as to be appropriate to who the user was that filled out the webform. 

My suggestion would be to instead build your own form, since it sounds like you have more than one dynamic aspect for what you need, and store the data that will be dynamic as a serialized array in a 'data' column in your own table.