What is the proper way to overwrite Javascript in AM 6?

This topic has 2 replies, 2 voices, and was last updated 3 years ago by Rey.

  • Author
  • #27043

    I know you can overwrite things like css, partials, and templates in AM 6, but I could not find any documentation on how to overwrite the Javascript files. My current issue is that I am trying to move the error message to a different location and change the html structure of it. Currently, this is being generated here “/src/main/js/org/forgerock/commons/ui/common/components/Messages.js”. Is there a way to overwrite this file and create your own javascript to handle the messages?

    Thanks for your time!

     Scott Heger

    You wouldn’t overwrite or create your own javascript but update the existing one in combination with CSS and HTML changes. For example, you can hide the message from popping up with CSS like:

    #messages {
        display: none !important;

    Then you can create a DIV wherever you’d like the message to appear in the HTML file like so:

    <div class="custom-alert no-display" class="clearfix"></div>

    Next you update the showMessage function in the Message.js file like so to remove the “no-display” class from the DIV so the error will be visible then insert the error message text into the DIV:


    You’ll have to add a “no-display” class to your CSS like:

    .no-display {
        display: none;

    That should get you going in the direction you want.


    Thanks @shegergmail-com that does help with some of it. I was looking to remove the default form client-side validation for the login (was able to do this with removing the data attributes) and add my own javascript library to use instead. My questions are… where should you store the javascript library code (ex: /project/src/main/js/config/validators) and where should I initiate the code so that it is loaded after the form is loaded ( Where should I call $(“#myform”).validate()… ). I was just wondering if there were best practices for this within the framework.

    Thank you for your time!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?