Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error values are not nested to the parent form #2383

Closed
mar627 opened this issue Apr 12, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@mar627
Copy link

commented Apr 12, 2019

Describe the bug
A single page with both a user:login form and a user:register form will display an error on both forms in the errors array if only one has an error.

To Reproduce

  1. Use the below snippet within a page
  2. Force an error, eg. entering incorrect credentials
  3. The errors tag will display the error of one form across both
    <div>
      {{ user:register_form }}
        {{ if errors }}
        <div class="alert alert-danger">
          {{ errors }}
          {{ value }}
          {{ /errors }}
        </div>
        {{ /if }}

        <input type="email" name="email" />
        <input type="password" name="password" />
        <input type="password" name="password_confirmation" />
        <button>Register</button>
      {{ /user:register_form }}
    </div>
    <div>
      {{ user:login_form }}
        {{ if errors }}
        <div class="alert alert-danger">
          {{ errors }}
          {{ value }}
          {{ /errors }}
        </div>
        {{ /if }}

        <input type="text" name="username"/>
        <input type="password" name="password"/>
        <button>Log in</button>
       {{ /user:login_form }}
     </div>

Expected behavior
Errors to display on their according forms only.

Environment details (please complete the following information):

  • 2.11.10
  • Upgrade
  • macOS
  • Nginx
  • PHP 7.2
  • Addons installed: Workshop, Hooker
@mar627

This comment has been minimized.

Copy link
Author

commented May 2, 2019

Hi @jasonvarga, Upgraded to 2.11.12 just now and I'm only getting errors when attempting to login with an empty field.. For scenarios like a wrong password or wrong username I get nothing.

the only error message I can trigger is: The password field field is required.

Test with this if you like, it's just the sample one from https://docs.statamic.com/tags/user-login_form:

{{ user:login_form }}

    {{ if errors }}
        <div class="alert alert-danger">
            {{ errors }}
                {{ value }}<br>
            {{ /errors }}
        </div>
    {{ /if }}


    <label>Username</label>
    <input type="text" name="username" value="{{ old:username }}" />

    <label>Password</label>
    <input type="password" name="password" value="{{ old:password }}" />

    <button>Log in</button>

{{ /user:login_form }}

Thanks again.

@mar627

This comment has been minimized.

Copy link
Author

commented May 7, 2019

Duplicate of #2388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.