0

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 1

1

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

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.