3 namespace Drupal\form_test\Form;
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Builds a simple form to test states.
11 * @see \Drupal\FunctionalJavascriptTests\Core\Form\JavascriptStatesTest
13 class JavascriptStatesForm extends FormBase {
18 public function getFormId() {
19 return 'javascript_states_form';
25 public function buildForm(array $form, FormStateInterface $form_state) {
28 '#title' => 'select 1',
29 '#options' => [0 => 0, 1 => 1, 2 => 2],
33 '#title' => 'enter 1',
35 $form['textfield'] = [
36 '#type' => 'textfield',
37 '#title' => 'textfield',
40 [':input[name="select"]' => ['value' => '1']],
42 [':input[name="number"]' => ['value' => '1']],
52 public function submitForm(array &$form, FormStateInterface $form_state) {