Answers.Body: <p>The registration form set's a flash message in the session, but that flash message doesn't know or care which page it came from. You're redirecting to the contact form immediately after the registration (<code>{{ redirectInput('contact') }}</code>), so the flash message isn't displayed on the registration page. This means that when the contact form is displayed, the flash message for the successful registration is still in the session, so it appears as a popup message.</p>
  <p>You could argue that this is the correct behaviour. You're redirecting to the contact form immediately after a successful registration, so without any confirmation message, the user won't know whether their registration succeeded. You can make the success message more specific (to make sure there's no misunderstandings), you can include a <code>successMessage</code> parameter in your registration form, and it will be used for the success flash message.</p>
  <p>If you want to avoid those flash messages displaying on the contact form, you can use a hook to clear any pending flash messages from the session after the registration.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-05T07:15:41.633Z
Answers.Text: I fixed it by giving each form its own popup.
Answers.UserDisplayName: aren
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-04T11:05:01.503Z
Answers.LastActivityDate: 2022-08-04T11:05:01.503Z
Answers.UserDisplayName: MoritzLost
Body: <p>So I have a contact form which shows a popup when it is submitted. I also have a registration and login form. The issue is: sometimes when a user logs in or registers an account, and you go to the contact page the popup is triggered (without filling in anything in the contact form or submitting)
  For the contact form I'm using the contact-form plugin.</p>
  <p>contact form:</p>
  <pre><code>&lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&gt;
      {{ csrfInput() }}
      {{ actionInput('contact-form/send') }}
      {{ redirectInput('contact') }}
  
      &lt;div class=&quot;form-group c-contact-item&quot;&gt;
        &lt;label for=&quot;from-name&quot;&gt;{{ entry.labelName }}&lt;/label&gt;
        &lt;input class=&quot;form-control&quot; type=&quot;text&quot; id=&quot;from-name&quot; name=&quot;fromName&quot; value=&quot;&quot; autocomplete=&quot;name&quot; placeholder=&quot;{{ entry.placeholderName }}&quot; required/&gt;
      &lt;/div&gt;
      {{ submission ? _self.errorList(submission.getErrors('fromName')) }}
      
      &lt;div class=&quot;form-group c-contact-item&quot;&gt;
        &lt;label for=&quot;from-email&quot;&gt;{{ entry.labelEmail }}&lt;/label&gt;
        &lt;input class=&quot;form-control&quot; type=&quot;email&quot; id=&quot;fromEmail&quot; name=&quot;fromEmail&quot; value=&quot;&quot; autocomplete=&quot;email&quot; placeholder=&quot;{{ entry.placeholderEmail }}&quot; required/&gt;
      &lt;/div&gt;
      {{ submission ? _self.errorList(submission.getErrors('fromEmail')) }}
      
      
      &lt;div class=&quot;form-group c-contact-item&quot;&gt;
        &lt;label for=&quot;from-tel&quot;&gt;{{ entry.labelTel }}&lt;/label&gt;
        &lt;input class=&quot;form-control&quot; type=&quot;fromTel&quot; id=&quot;message[tel]&quot; name=&quot;message[tel]&quot; value=&quot;&quot; autocomplete=&quot;tel&quot; placeholder=&quot;{{ entry.placeholderTel }}&quot; required/&gt;
      &lt;/div&gt;
      {{ submission ? _self.errorList(submission.getErrors('tel')) }}
  
      &lt;div class=&quot;c-contact-item&quot;&gt;
        &lt;label for=&quot;message&quot;&gt;{{ entry.labelBericht }}&lt;/label&gt;
        &lt;textarea cols=&quot;30&quot; rows=&quot;5&quot; class=&quot;form-control&quot; name=&quot;message[body]&quot; id=&quot;message&quot; placeholder=&quot;{{ entry.placeholderBericht }}&quot; required&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      {{ submission ? _self.errorList(submission.getErrors('message')) }}
      &lt;div class=&quot;c-contact-checkbox&quot;&gt;
                &lt;div&gt;
                  &lt;label class=&quot;container&quot;&gt;
                    &lt;input class=&quot;form-check-input&quot; type=&quot;checkbox&quot; required/&gt;
                    &lt;span class=&quot;checkmark&quot;&gt;&lt;/span&gt;
                    {% set privacyLinkLink = privacyLink.meerInfomatieButtonLink.one() %}
                    &lt;a href=&quot;{{ privacyLinkLink.url }}&quot;&gt;&lt;p style=&quot;color:#353535;&quot;&gt;{{ privacyLink.meerInformatieButtonText }}&lt;p&gt;&lt;/a&gt;
                  &lt;/label&gt;
                &lt;/div&gt;
              &lt;/div&gt;
  
      &lt;button class=&quot;c-button&quot; type=&quot;submit&quot; style=&quot;border: none;&quot;&gt;{{ entry.contactButton }}&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>log form:</p>
  <pre><code>&lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot;&gt;
                      {{ csrfInput() }}
                      {{ actionInput('users/login') }}
  
                      &lt;label class=&quot;c-login__label&quot; for=&quot;loginName&quot;&gt;{{ entry.usernameLabel }}&lt;/label&gt;
                      {{ input('text', 'loginName', craft.app.user.rememberedUsername, {
                          id: 'loginName',
                          autocomplete: 'username',
                          class: &quot;c-login__input&quot;
                      }) }}
  
                      &lt;label class=&quot;c-login__label&quot; for=&quot;password&quot;&gt;{{ entry.passwordLabel }}&lt;/label&gt;
                      {{ input('password', 'password', null, {
                          id: 'password',
                          class: &quot;c-login__input&quot;
                      }) }}
                     
                      &lt;label class=&quot;login-checkbox-label&quot;&gt;
                          {{ input('checkbox', 'rememberMe', '1', {
                              class: 'login-checkbox',
  
                          }) }}
                          &lt;span class=&quot;checkmark&quot;&gt;&lt;/span&gt;
                          &lt;p&gt;{{ entry.rememberme }}&lt;/p&gt;
                      &lt;/label&gt;
  
                      &lt;button class=&quot;c-button c-button--secondary c-contactme__group-button login-button c-login__button&quot; type=&quot;submit&quot;&gt;{{ entry.loginButton }}&lt;/button&gt;
  
                      {% if errorMessage is defined %}
                          &lt;p class=&quot;password-forget&quot;&gt;{{ errorMessage }}&lt;/p&gt;
                      {% endif %}
                  &lt;/form&gt;
  </code></pre>
  <p>popup:</p>
  <pre><code>{% if craft.app.session.hasFlash('notice') %}
      &lt;div class=&quot;popup-container&quot;&gt;
          &lt;div class=&quot;popup&quot;&gt;
              &lt;h3&gt;{{ entry.popupSucces }}&lt;/h3&gt;
          &lt;/div&gt;
      &lt;/div&gt;                   
      {% elseif craft.app.session.hasFlash('error') %}
      &lt;div class=&quot;popup-container&quot;&gt;
          &lt;div class=&quot;popup&quot;&gt;
              &lt;h3&gt;{{ entry.popupError }}&lt;/h3&gt;
          &lt;/div&gt;
      &lt;/div&gt; 
  {% endif %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-04T10:18:47.997Z
Comments.Text: Please post the template you're using to display the popups.
Comments.UserDisplayName: MoritzLost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-04T10:28:01.843Z
Comments.Text: I have added it.
Comments.UserDisplayName: aren
Tags: <users><form><login>
Title: Register form activating other forms
ThreadText: # Register form activating other forms
  
  (Asked by: username_0 on 2022-08-04)
  
  So I have a contact form which shows a popup when it is submitted. I also have a registration and login form. The issue is: sometimes when a user logs in or registers an account, and you go to the contact page the popup is triggered (without filling in anything in the contact form or submitting)
  For the contact form I'm using the contact-form plugin.
  
  contact form:
  
  ```
  <form method="post" action="" accept-charset="UTF-8">
      {{ csrfInput() }}
      {{ actionInput('contact-form/send') }}
      {{ redirectInput('contact') }}
  
      <div class="form-group c-contact-item">
        <label for="from-name">{{ entry.labelName }}</label>
        <input class="form-control" type="text" id="from-name" name="fromName" value="" autocomplete="name" placeholder="{{ entry.placeholderName }}" required/>
      </div>
      {{ submission ? _self.errorList(submission.getErrors('fromName')) }}
      
      <div class="form-group c-contact-item">
        <label for="from-email">{{ entry.labelEmail }}</label>
        <input class="form-control" type="email" id="fromEmail" name="fromEmail" value="" autocomplete="email" placeholder="{{ entry.placeholderEmail }}" required/>
      </div>
      {{ submission ? _self.errorList(submission.getErrors('fromEmail')) }}
      
      
      <div class="form-group c-contact-item">
        <label for="from-tel">{{ entry.labelTel }}</label>
        <input class="form-control" type="fromTel" id="message[tel]" name="message[tel]" value="" autocomplete="tel" placeholder="{{ entry.placeholderTel }}" required/>
      </div>
      {{ submission ? _self.errorList(submission.getErrors('tel')) }}
  
      <div class="c-contact-item">
        <label for="message">{{ entry.labelBericht }}</label>
        <textarea cols="30" rows="5" class="form-control" name="message[body]" id="message" placeholder="{{ entry.placeholderBericht }}" required></textarea>
      </div>
      {{ submission ? _self.errorList(submission.getErrors('message')) }}
      <div class="c-contact-checkbox">
                <div>
                  <label class="container">
                    <input class="form-check-input" type="checkbox" required/>
                    <span class="checkmark"></span>
                    {% set privacyLinkLink = privacyLink.meerInfomatieButtonLink.one() %}
                    <a href="{{ privacyLinkLink.url }}"><p style="color:#353535;">{{ privacyLink.meerInformatieButtonText }}<p></a>
                  </label>
                </div>
              </div>
  
      <button class="c-button" type="submit" style="border: none;">{{ entry.contactButton }}</button>
  </form>
  
  ```
  
  log form:
  
  ```
  <form method="post" accept-charset="UTF-8">
                      {{ csrfInput() }}
                      {{ actionInput('users/login') }}
  
                      <label class="c-login__label" for="loginName">{{ entry.usernameLabel }}</label>
                      {{ input('text', 'loginName', craft.app.user.rememberedUsername, {
                          id: 'loginName',
                          autocomplete: 'username',
                          class: "c-login__input"
                      }) }}
  
                      <label class="c-login__label" for="password">{{ entry.passwordLabel }}</label>
                      {{ input('password', 'password', null, {
                          id: 'password',
                          class: "c-login__input"
                      }) }}
                     
                      <label class="login-checkbox-label">
                          {{ input('checkbox', 'rememberMe', '1', {
                              class: 'login-checkbox',
  
                          }) }}
                          <span class="checkmark"></span>
                          <p>{{ entry.rememberme }}</p>
                      </label>
  
                      <button class="c-button c-button--secondary c-contactme__group-button login-button c-login__button" type="submit">{{ entry.loginButton }}</button>
  
                      {% if errorMessage is defined %}
                          <p class="password-forget">{{ errorMessage }}</p>
                      {% endif %}
                  </form>
  
  ```
  
  popup:
  
  ```
  {% if craft.app.session.hasFlash('notice') %}
      <div class="popup-container">
          <div class="popup">
              <h3>{{ entry.popupSucces }}</h3>
          </div>
      </div>                   
      {% elseif craft.app.session.hasFlash('error') %}
      <div class="popup-container">
          <div class="popup">
              <h3>{{ entry.popupError }}</h3>
          </div>
      </div> 
  {% endif %}
  
  ```
  
  **Tags:** users, form, login
  
  > **Comments:**
  > **username_1**: Please post the template you're using to display the popups.  
  > **username_0**: I have added it.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-08-04. Score: 0 | Accepted answer
  
  The registration form set's a flash message in the session, but that flash message doesn't know or care which page it came from. You're redirecting to the contact form immediately after the registration (`{{ redirectInput('contact') }}`), so the flash message isn't displayed on the registration page. This means that when the contact form is displayed, the flash message for the successful registration is still in the session, so it appears as a popup message.
  
  You could argue that this is the correct behaviour. You're redirecting to the contact form immediately after a successful registration, so without any confirmation message, the user won't know whether their registration succeeded. You can make the success message more specific (to make sure there's no misunderstandings), you can include a `successMessage` parameter in your registration form, and it will be used for the success flash message.
  
  If you want to avoid those flash messages displaying on the contact form, you can use a hook to clear any pending flash messages from the session after the registration.
  
  > **Comments:**
  > **username_0**: I fixed it by giving each form its own popup.  
  
  ---
  
  