Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292566

The same form twice on one page with different arguments may process the wrong form when submitted

$
0
0

Problem/Motivation

If the same form is on a page multiple times and with different arguments, submitting the second form may accidentally be processed with the first form's arguments. Steps to reproduce:

- Have a simple form that does not use #ajax. The #ajax property will force $form_state['cache'] = TRUE, and inadvertently "fix" the bug.
- Pass in different parameters to the form and call it twice on the same menu path.
- Submit the second form.
- You get the results from the first form's arguments, rather than the second one.

Proposed resolution

Create a consistent hash or indicator that can be used across page requests to identify when the same form has been built multiple times on the same page. Actual solution TBD. But some possibilities include:

  • This may be a "form_build_count" based on the order the form was built.
  • An automatic "form_args_hash" that is made up of the original arguments to separate the two identical forms.
  • A manually-provided indicator to separate if the form needs to be supported on the same page multiple times.

Remaining tasks

Solution to be determined. Test coverage expanded to include this bug.

User interface changes

None.

API changes

TBD

Data model changes

None.


Viewing all articles
Browse latest Browse all 292566

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>