Form validation on custom account theme

I’m trying to understand how (or if) Keycloak is doing form validation on a custom theme. Specifically, I’m updating the account/password.ftl.

I’ve noticed in login/registration.ftl (also a custom theme), we use something like this to add error messages to the DOM, and using Bootstrap we add appropriate stylings:

<div class="invalid-feedback">${messagesPerField.get("password")}</div>

But this doesn’t do anything in the password update form. The Keycloak server logs do show appropriate errors, but this messagesPerField.get() call doesn’t return anything.

I’d appreciate any enlightenment on the matter, and if possible appropriate documentation. Thanks.