public function LearningPathCreateClassForm::submitFormAjax in Opigno Learning path 8
Same name and namespace in other branches
- 3.x src/Form/LearningPathCreateClassForm.php \Drupal\opigno_learning_path\Form\LearningPathCreateClassForm::submitFormAjax()
Handles AJAX form submit.
File
- src/
Form/ LearningPathCreateClassForm.php, line 96
Class
- LearningPathCreateClassForm
- Members create form.
Namespace
Drupal\opigno_learning_path\FormCode
public function submitFormAjax(array $form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$form = \Drupal::formBuilder()
->getForm('Drupal\\opigno_learning_path\\Form\\LearningPathCreateMemberForm');
if ($form_state->hasValidateError) {
$response
->addCommand(new HtmlCommand('#learning_path_create_class_form_messages', $this
->t('Please select at least one user')));
}
else {
$response
->addCommand(new ReplaceCommand('#learning_path_create_class_form', $form));
}
return $response;
}