I know that the values
array can be cleaned up in the validation or submit callback, but can we somehow mark the element itself to be not put in the values
array of the FormState
?
1 Answer
Not within the building of the form as far as I know. You'd need to strip out the values you don't want in the submit handler as you mentioned.
This is probably the easiest way to remove the default form values:
$values = $form_state->cleanValues()->getValues();
That will remove: form_id, form_token, form_build_id, op