as far as I understand it whenever you submit and rebuild a form (e.g. 'Add another item' on fields with infinite cardinality) something like this happens:
- User submits a form with filled values
- User input is copied to $form_state
- Element validation happens
- Form validation happens
drupal_get_form
is called (form is being rebuild)- ??? old user input from $form_state is copied to every
$element[#value]
- Individual elements of the form are created in
$element[#process]
callbacks - Rebuild form is shown to a user
My question is, when and how is user input from the old form transferred into the new one?
From what I've been able to understand by reading the documentation it must happen somewhere in drupal_build_form
before the element #process
callback is called. But when exactly that I haven't been able to find.
//I know about this FAPI flowchart if anyone could point me in the right direction on it I'd appreciate it.
old user input from $form_state is copied to every $element[#value]
is it? Never noticed. By the book#value
is used only by button, hidden, image_button, submit, token, value. Where exactly you managed tovar_dump
orkpr
your form and see#value
s set for elements that wasn't set by you? It is not a rhetorical question. First, you are looking for something and I want to know it really happens. Second, knowing when they are for sure set and when they are not will tell us where to look.