Howto set warning notifications and intercept onSubmit Events in a custom theme?

Hello together,
I am currently trying to setup a custom theme and therefore try to extend the keycloak theme. My current ui looks as follows and the image also shows what I am trying to achive.
I have successfully added a slider button to disable the users account. However, currently it does not do anything. I am now trying to achieve two things:

  1. That a warning message shows up when the switch is activated, similar to the error message from the keycloak theme which is displayed when a user provides a wrong input. Like the one which is shown on the provided image. Seems there is a warning message already available in the templates, but I have not found a way yet, how to activate it. I am new to all this freemaker stuff if one could give me an easy explanation that would be great.

  2. When the submit button is pressed a submitActions seems to be triggered from keycloak in some way. from the .ftl template

${msg(“doSave”)}

Seems like the submitAction is not a javascript function but some kind of Javabeen which is triggered somehow. I would like to intercept the message to execute a custom javascript function and then call the submitAction from the Javabeen. However, I do not understand how to do this and how the parameters are passed to the been. Is this the part which provides parameters to the been. value=“Save”>${msg(“doSave”)} ? If so, how could I provide parameters from a javascript function in case the been obtains the parameters from parsing the html?

Thanks for your help!
Best regards,
Christoph