1

I am trying to find the $form_id using the Devel module.

Sometimes when I output a form, $form_id is output with a single value. However, sometimes the output of dpm($form) looks like this:

form_id output

What is the difference between #value and #id here? Which is the $form_id?

2

$form_id always has _ in it. Because in hook_form_FORM_ID_alter() you always have to put replace FORM_ID with $form_id so you can't put - in function name.

$form_id: String representing the name of the form itself. Typically this is the name of the function that generated the form.

And #id is html safe id. id attribute for form tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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