Uploaded image for project: 'eZ Platform Enterprise Edition'
  1. eZ Platform Enterprise Edition
  2. EZEE-2939

Submitting one form submits all forms of the same type on the page

    XMLWordPrintable

Details

    Description

      When there is more than one form of the same type on the same page (for example contact form in the footer, when the contact form is displayed, using line view to render link) and one is submitted, second is submitted as well, which results in duplicated submissions and multiple e-mails being sent.

      Steps to reproduce
      1. Clean installation of eZ Platform EE 2.5.6
      2. Properly configured swiftmailer.
      3. Log in to the back office as an Admin, create a new Form Test Form with two fields: Single line and Button. Set Button action to display message "Sent!" and notification on e-mail. Publish it.
      4. In ezplatform.yml set:

      ezpublish:
          #...
          system:
              #...
              site:
                  pagelayout: pagelayout.html.twig
      

      pagelayout.html.twig

      <!doctype html>
      <html lang="en">
      <head>
          <meta charset="utf-8">
          <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
          <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
      
          <title>Hello, world!</title>
      </head>
      <body>
      <div class="container">
          <h1>Hello, world!</h1>
          {% block content %}
          {% endblock %}
          <hr>
          {{ render( controller( "ez_content:viewAction", { 'contentId': <test_form_content_id>, 'viewType': parameters.view|default('embed'), 'noLayout': 1 } )) }}
      </div>
      </body>
      </html>
      

      Replace <test_form_content_id> with Test Form Content ID.
      5. Add Form Block to Home, select Test Form. Publish it.
      6. Open Home in site SiteAccess.
      7. Submit one of the forms.

      Result
      Both Forms will be submitted - you will see two "Sent!" messages, there will be two entries in Submissions Tab for Test Forn and two e-mails sent.

      Expected Result
      Only a single Form is submitted.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mateusz.bieniek@ibexa.co Mateusz Bieniek
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: