@Anandaakrishnan G A

Account created on 28 February 2023, over 1 year ago
#

Recent comments

Make sure that changes made to the form via AJAX are properly tracked in the form state. In Drupal, if a part of the form is added dynamically (like your biz_wrapper), its values might not be properly included in the form state unless the form structure is adequately managed across callbacks.

//
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\ReplaceCommand;
public function accountTypeDropdownCallback(array &$form, FormStateInterface $form_state) {
$form_state->setRebuild(true);
$response = new AjaxResponse();
$response->addCommand(new ReplaceCommand('#biz-wrapper', $form['biz_wrapper']));
return $response;
}

Production build 0.69.0 2024