How To enable and disable register button in registration form in FTL

hi,

i Want to disabled register button if the input field is empty on my registration page. after putting all the required inputs the register button will enabled.
required inputs is checkbox, text box

if this behavior is possible from themes please provide me document for this.

thanking you

You can do this with a custom theme. Documentation on creating a custom theme is here: Server Developer Guide

The input validation you’re suggesting is possible using javascript. You will have to customize the register.ftl template here: keycloak/register.ftl at master · keycloak/keycloak · GitHub

Hi,
thanks to you my button functionality is working good.
is it possible to handle custom user attribute using displayMessage i.e. you provided method in above documents by keycloak.
or we have to use external javascript only ?

Thanking you.

Sorry, but I don’t understand the question. If you want to add custom fields in the registration form, there are some examples in the documentation: Server Developer Guide

hi,

how we can add the required validations in theme only , or do we need to add the script to handle the custom attributes validations

Thanking you

If you want the attributes to be validated on the frontend, you’ll have to write custom javascript. If you want to do it on the backend, you’ll have to write a custom FormAction and add it to the registration flow.

Hi,

How to add themes custom fields value in keycloak servers user attributes.

Thanking you.

Adding a custom field in the registration ftl is as simple as adding an input field with the naming convention user.attributes.<field_name>. For example, if you want to add a field for phone number, you could call it user.attributes.phone and that will store the value as a user attribute with key phone. There is a good example here: https://keycloakthemes.com/blog/how-to-add-custom-field-keycloak-registration-page