I have a form which has a checkboxes field.
This field has an ajax callback attached
$form['checkboxes'] = array(
'#type' => 'checkboxes',
'#title' => 'test',
'#ajax' => array(
'callback' => 'mymodule_ajax_callback',
'wrapper' => 'test-wrapper',
'method' => 'replace'
);
);
function mymodule_ajax_callback(&form, &$form_state) {
return $form['another-field'];
}
When I check a checkbox, the ajax callback is executed. Then when I try to submit the form through form submit button, it reloads the same page with values in the fields, but the form is not submitted.
I have tried $form_state['rebuild'] = TRUE
in the ajax callback also but it did not help.
I have added the #name
and #id
properties also to the submit button but no luck.
Is there any other solution which I can try?