How to add multiple value textfield to Drupal form?
-
30-10-2019 - |
Вопрос
Is it possible and how to implement one textfield with multiple values in drupal form?
Say, I have the next code:
function mymodule_admin_settings() {
$form['email'] = array(
'#type' => 'fieldset',
// ...
);
$form['email']['mymodule_email_recepient'] = array(
'#type' => 'textfield',
'#title' => t('Recepient'),
'#default_value' => variable_get('mymodule_email_recepient', 'email@domain.com'),
'#element_validate' => array('mymodule_email_validation'),
'#maxlength' => 30,
'#required' => TRUE,
);
// ...
return system_settings_form($form);
}
What should I change for this form
to show multiple textfields, e.g.
<input name="mymodule_email_recepient[]" type="text" />
;to call
variable_set('mymodule_email_recepient', array( /*some values*/ ))
on submit.
Thanks for advance!
Нет правильного решения
Не связан с StackOverflow