Ajax rebuild form is calling all the code from my form function I have a form which when I click on on radio rebuild an element of the same form. Somehow when the ajax is called it's recalling everything from my form function.
How can I force him to reload only a part of the code, in that case the $form['container']['network'] and not the whole $form.

There must be some strange behavior during the callback, could it be reloading the whole form and get the part it wants then replace the old by the new?

$form['container']['ZoneId']['#ajax'] = array(
    'callback' =&gt; 'change_countries',
    'wrapper' =&gt; 'networks-list',
    'method' =&gt; 'replace',
    'effect' =&gt; 'fade',
);

$form['container']['network'] = array(
    '#type' =&gt; 'fieldset',
    '#prefix' =&gt; t('&lt;div id="networks-list" class="checkbox-styling"&gt;'),
    '#suffix' =&gt; '&lt;/div&gt;',
);

function change_countries($form, $form_state) {
    $form_state['rebuild'] = TRUE;
    return $form['container']['network'];
}
You shouldn't need:

$form_state['rebuild'] = TRUE;


Otherwise your callback looks correct.