3 namespace Drupal\form_test\Form;
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Form constructor to test the #required property without #title.
11 class FormTestValidateRequiredNoTitleForm extends FormBase {
16 public function getFormId() {
17 return 'form_test_validate_required_form_no_title';
23 public function buildForm(array $form, FormStateInterface $form_state) {
24 $form['textfield'] = [
25 '#type' => 'textfield',
28 $form['actions'] = ['#type' => 'actions'];
29 $form['actions']['submit'] = ['#type' => 'submit', '#value' => 'Submit'];
36 public function submitForm(array &$form, FormStateInterface $form_state) {
37 drupal_set_message('The form_test_validate_required_form_no_title form was submitted successfully.');