Managed file input is removing input values of appended input fields by ajax I have a form with checkboxes that are calling ajax callback on checked. This ajax callback is appending another inputs:

$form['expertise']['op-cat-'.$op_cat['id']]['op-'.$op['id']]['checked'] = array(
    '#type' =&gt; 'checkbox',
    '#title' =&gt; $op['name'],
    '#default_value' =&gt; isset($usr['user_scope']['tid'][$op['id']]) ? 1 : 0,
    '#ajax' =&gt; array(
        'callback' =&gt; 'activit_full_profile_expertise_ajax',
        'wrapper' =&gt; 'expertise-div',
    )
);


Ajax callback:

function activit_full_profile_expertise_ajax($form, &amp;$state) {

    $commands = array();
    $commands[] = ajax_command_html('#expertise-div', render($form['expertise']));
    $commands[] = array('command' =&gt; 'reinitializeTooltipster');
    return array('#type' =&gt; 'ajax', '#commands' =&gt; $commands);

}


In form is also an another managed file input:

$form['image'] = array(
    '#type' =&gt; 'managed_file',
    '#title' =&gt; t('Profilová fotografia &lt;span&gt;(nepovinné)&lt;/span&gt;'),
    '#default_value' =&gt; isset($usr['picture']-&gt;fid) ? $usr['picture']-&gt;fid : 0,
    '#upload_validators' =&gt; array('file_validate_extensions' =&gt; array('gif png jpg jpeg')),
    '#upload_location' =&gt; 'public://user_images/'
);


Everything works fine if image field is not used after checkbox. If checkbox is used before image upload, it brings another input fields, but they are not present in $state['values'] in form validate &amp; submit function (only original checkbox is present). They are not present in validate &amp; submit function called by ajax of this image upload input, therefore they are not present in final validate &amp; submit functions on form submit.

I have another custom ajax callbacks in form, but the appended input values are allways present. Is this a Drupal bug or am I missing something?
I'm not sure if this is a good solution, but now I'm taking values from $state['input'] instead of $state['values'].