<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>

CC BY-SA 4.0
2022-08-05T07:15:41.633Z
I fixed it by giving each form its own popup.
aren
CC BY-SA 4.0
2022-08-04T11:05:01.503Z
2022-08-04T11:05:01.503Z
MoritzLost
<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>

CC BY-SA 4.0
2022-08-04T10:18:47.997Z
Please post the template you're using to display the popups.
MoritzLost
CC BY-SA 4.0
2022-08-04T10:28:01.843Z
I have added it.
aren
<users><form><login>
Register form activating other forms
# 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:

    {{ csrfInput() }}
    {{ actionInput('contact-form/send') }}
    {{ redirectInput('contact') }}

    
      {{ entry.labelName }}
      
    
    {{ submission ? _self.errorList(submission.getErrors('fromName')) }}
    
    
      {{ entry.labelEmail }}
      
    
    {{ submission ? _self.errorList(submission.getErrors('fromEmail')) }}
    
    
    
      {{ entry.labelTel }}
      
    
    {{ submission ? _self.errorList(submission.getErrors('tel')) }}

    
      {{ entry.labelBericht }}
      
    
    {{ submission ? _self.errorList(submission.getErrors('message')) }}
    
              
                
                  
                  
                  {% set privacyLinkLink = privacyLink.meerInfomatieButtonLink.one() %}
                  {{ privacyLink.meerInformatieButtonText }}
                
              
            

    {{ entry.contactButton }}


log form:

                    {{ csrfInput() }}
                    {{ actionInput('users/login') }}

                    {{ entry.usernameLabel }}
                    {{ input('text', 'loginName', craft.app.user.rememberedUsername, {
                        id: 'loginName',
                        autocomplete: 'username',
                        class: "c-login__input"
                    }) }}

                    {{ entry.passwordLabel }}
                    {{ input('password', 'password', null, {
                        id: 'password',
                        class: "c-login__input"
                    }) }}
                   
                    
                        {{ input('checkbox', 'rememberMe', '1', {
                            class: 'login-checkbox',

                        }) }}
                        
                        {{ entry.rememberme }}
                    

                    {{ entry.loginButton }}

                    {% if errorMessage is defined %}
                        {{ errorMessage }}
                    {% endif %}
                

popup:
{% if craft.app.session.hasFlash('notice') %}
    
        
            {{ entry.popupSucces }}
        
                       
    {% elseif craft.app.session.hasFlash('error') %}
    
        
            {{ entry.popupError }}
        
     
{% 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.  

---

