I'm using this in node add form alter to hide field 'field_obyavlenie_ploschad_uch':
$form['field_obyavlenie_ploschad_uch']['#states'] = [
'invisible' => [
'select[name="field_obyavlenie_rubrika"]' => ['value' => '4524'],
]
];
But if user enter any value in this field (before the field was hiding) I see this value in Node view.
I'm trying empty field value, but it not working:
$form['field_obyavlenie_ploschad_uch']['#states'] = [
'empty' => [
'select[name="field_obyavlenie_rubrika"]' => ['value' => '4524'],
]
];
How empting invisible field?