I am trying to remove the value(_blank) of attribute[‘target’] variable in form_state when the value I get empty i.e. when the checkbox is unselected. public function submitForm(array &$ form, FormStateInterface $ form_state) { $ response = new AjaxResponse(); if ($ form_state->getErrors()) { unset($ form[‘#prefix’], $ form[‘#suffix’]); $ form[‘status_messages’] = [ ‘#type’ => ‘status_messages’, ‘#weight’ =>Read more