DocumentationAEMAEM TutorialsAEM Forms Tutorials

Using custom functions and code editor

Last update: March 25, 2025
  • Applies to:
  • Experience Manager 6.4
  • Experience Manager 6.5
  • Topics:
  • Adaptive Forms

CREATED FOR:

  • Beginner
  • Developer

In this part, we will use custom functions and the code editor to author business rules.

you have already installed the ClientLib with custom function earlier in this tutorial.

Typically a client library consists of CSS and Javascript file. This client library contains javascript file which exposes a function to populate drop-down list values.

Function to Populate Drop Down List

video poster

https://video.tv.adobe.com/v/22282?quality=12&learn=on

Set Summary Title of Panel

video poster

https://video.tv.adobe.com/v/28387?quality=12&learn=on

Validate Panel

video poster

https://video.tv.adobe.com/v/28409?quality=12&learn=on

The following is the code used to validate panel fields

//debugger;
var errors =[];
var fields ="";
var currentPanel = guideBridge.getFocus({"focusOption": "navigablePanel"});
window.guideBridge.validate(errors,currentPanel);
console.log("The errors are "+ errors.length);
if(errors.length===0)
{
        window.guideBridge.setFocus(this.panel.somExpression, 'nextItem', true);
}
else
  {
    for(var i=0;i<errors.length;i++)
      {
        var fields = fields+guideBridge.resolveNode(errors[i].som).title+" , ";
      }
        window.confirm("Please fill out  "+fields.slice(0,-1)+ " fields");
  }

You can uncomment line 1 to debug the code in browser window.

Line 4 - Get the current panel

Line 5 - Validate the current panel.

Line 9 - If no errors move to the next panel

Preview the form, and test the newly enabled functionality.

recommendation-more-help
8de24117-1378-413c-a581-01e660b7163e