I'm developing custom module and there's one fieldset that can be added multiple times and can be removed any particular entry also. Can anyone please suggest to achieve this? Here is my code:
function hook_form($form,&$form_state){
$form_state['storage']['emails'] =
isset($form_state['storage']['emails']) ? $form_state['storage']['emails'] : 0;
$form['emails'] = array(
'#type' => 'container',
'#tree' => TRUE,
'#prefix' => '<div id="emails">',
'#suffix' => '</div>',
);
if(empty($form_state['storage']['emails'])) {
$form_state['storage']['emails'] = 0;
}
for ($j = 0; $j <= $form_state['storage']['emails']; $j++) {
$form['emails'][$j]['candidate_email'] = array(
'#title' => 'Email',
'#type' => 'textfield',
'#size' => '30',
'#required' => FALSE,
);
}
$form['emails']['add_email'] = array(
'#type' => 'button',
'#value' => t('Add Email'),
'#href' => '',
'#ajax' => array(
'callback' => 'hook_ajax_add_emails',
'wrapper' => 'emails',
),
);
$form_state['storage']['emails']++;
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
);
return $form;
}
function hook_ajax_add_emails($form, $form_state) {
return $form['emails'];
}
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.