I need to clear any data from an address field's values (administrative area, etc.)

In my custom submit hanlder for node form, I know I can use something like below for a standard field:

  $form_state->setValue('field_alternate_phone', [['value' => 'NEW VALUE']]);

But I cannot figure out how to change the value of a nested address field where the values are something like:

enter image description here

I've solutions similar to below but nothing is working:

$form_state->setValue('field_service_location', [
    ['address' => ['organization' => 'test22111']]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.