-3

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.

  • 5
    Why would you render a form inside of a form? – Kevin Oct 29 '19 at 0:36
  • @Kevin Yes, I know it now. It was a mistake. I couldn't found the reason for the message. I write the question and someone would find it faster. – Mykola Veriga Oct 29 '19 at 15:27
  • So you are not doing that? Was trying to understand what the problem to solve was that led to that. – Kevin Oct 29 '19 at 15:40
  • @Kevin yes, I don't do that. I just thought if someone get the same error – Mykola Veriga Oct 29 '19 at 16:07
4

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:

https://www.drupal.org/project/finder/issues/1383918

Drupal adds a #token thing (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.

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