I am using FAPI with dynamic fields. The code I am using is:
function email_action($form, &$form_state) {
$result = db_query('Select * from my_action_plan_settings ORDER BY action_type');
$records = array();
foreach ($result as $record) {
$records[] = $record->poa;
}
for ($i = 0; $i < count($records) ; $i++) {
$form['action'] = array(
'#type' => 'fieldset',
'#title' => t('Action #@num', array('@num' => $i)),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['action'][$i]['poa'] = array(
'#type' => 'textfield',
'#title' => t('Point of Action'),
'#default_value' => $point_of_actions[$i],
'#description' => t("Enter first name."),
'#required' => FALSE,
);
$form['action'][$i]['email'] = array(
'#type' => 'textfield',
'#title' => t('Email Address'),
'#required' => FALSE,
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
);
return $form;
}
function email_action_submit($form, &$form_state) {
dsm($form_state);
}
The submit handler never gets called, I used a custom submit handler also, it does not get called. If I limit the count of loop to 20, the submit handler gets called and everything works fine but without breaking the for loop, the submit handler never get called, is there a limit to number of fields? Or am I doing something wrong. Not sure what the issue is.