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

FR: Add inline error array to form tags #2090

dannyuk1982 opened this issue Jul 30, 2018 · 1 comment


Copy link

commented Jul 30, 2018

With a form there are two arrays errors, which contains an array of all the errors, keys from 0...n, and an error array which has named keys to allow inline errors to be displayed.

For tags like user:forgot_password_form, user:login_form, user:register_form and user:reset_password_form there is no way to have inline errors as only the errors array exists.


This comment has been minimized.

Copy link

commented Nov 16, 2018

If anyone is looking for a very hacky solution, try this:

{{ user:register_form }}
    <label for="password">Password</label>
    <input class="{{ if errors:0 | contains:Password or errors:1 | contains:Password or errors:2 | contains:Password }}invalid{{ /if }}" type="password" name="password" />
    <span>{{ if errors:0 | contains: Password or errors:1 | contains: Password or errors:2 | contains: Password }}Please provide a password{{ /if }}</span>
{{ /user:register_form }}

It’s really dirty and I feel guilty ;) I tried a slightly cleaner hack but unfortunately, it does not work at all:

{{ if (errors | in_array: Password) }}Please provide a password{{ /if }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.