Submitting a form with ajax, when multiple instances of the same form are on a page
You can do this by setting a custom form ID for each form. So you define your form like this:

class MyForm {
  protected $formId;

  public function __construct($formId) {
    $this-&gt;formId = $formId;
  }

  public function getFormId() {
    return 'my_form-' . $formId;
  }
}


Then, when you call your form, you pass a unique Form ID for each form:

$my_form = new MyForm('some-unique-id');
$form = \Drupal::formBuilder()-&gt;getForm($my_form);


Pass a different ID for each form on the page.