Open dannyuk1982 opened 6 years ago
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 }}
With a form there are two arrays
errors
, which contains an array of all the errors, keys from 0...n, and anerror
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
anduser:reset_password_form
there is no way to have inline errors as only theerrors
array exists.