Show Menu
TOPICS×

Using custom functions and code editor

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


Set Summary Title of Panel


Validate Panel


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.