How I can fix the error?
The form has become outdated. Copy any unsaved work in the form below and then reload this page.
I get the error when I try to render a form in another form. I think it can help to someone in the future.
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
Drupal Form API sets a form token to prevent you from modifying forms in this way for security reasons.
Consider this issue queue on Drupal.org:
Drupal adds a
#tokenthing (which is reflected in a hidden field) for registered users to prevent people tricking others into submitting a form for them
Reading the whole thread, you'll see a couple of options to get rid of this error message (e.g., by setting
$form['#token'] = NULL or
unset($form['#token'])) but they are all bad ideas from a security perspective.