0
다음
내가 드루팔 (8)에 다음과 같은 이름의 여러 입력 필드를 만들려면 어떻게해야합니까Drupal 8에서 제출할 때 같은 이름의 여러 필드를 만들고 값을 가져 오는 방법은 무엇입니까?
<?php
namespance Drupal\hello_world\Form;
class MailForm extends ConfigFormBase {
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form['email_address'] = [
'#type' => 'email',
'#title' => $this->t(
'Email address:'
),
];
return $form;
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$email_address = $form_state->getValue('email_address');
}
}
드루팔 8에서 내 사용자 정의 모듈의 구성 양식입니까?
<input name="email_address[]" type="email" />
<input name="email_address[]" type="email" />
<input name="email_address[]" type="email" />
Drupal 8에서 제출할 때 위 입력란의 모든 값을 어떻게 얻을 수 있습니까?
array(
'email_address' => array(
'0' => '[email protected]',
'1' => '[email protected]',
'2' => '[email protected]',
)
)
양식을 제출할 때이 입력 값을 얻는 방법은 무엇입니까? –
$ form_state-> getValue ('email_address')는 값 배열을 반환해야합니다. –