Portal Connector Secrets, Shhhh... (Part 2)
In my last blog post (see here), I have mainly concentrated on the backend functionality of The Portal Connector widgets. But as a web developer, I’m excited to share some insight into the secret functionality that we have added to the JavaScript API.
TPC Object
The TPC javascript object exposes some very useful information to the client side. To get the TPC object simply type in the “tpc” in the browser console and this will show you some of the functionality that is available to be accessed in the front end.
The Portal Connector Version
To get the version of The Portal Connector you have installed, simply type in “tpc.version” in the console.
The Portal Connector Forms
To get an array of the forms that are active on the current page, simply type in “tpc.forms” in the console.
This will also allow you to access the form widgets inside individual forms. Here is an example of accessing a Portal Connector form widget inside a form:
To get the Form Name of the form, simply type in “tpc.forms[0].$$name”. Where 0 is the index of the form you want to access.
The Portal Connector Pages Widgets
To get the Portal Connector page widgets, simply type in “tpc.page”. This will give an object listing the page widgets that are in the current page and it allows you to access the API for individual page widgets.
Click here for more information about the individual TPC Widgets API.
Validate Portal Connector Form
You can easily validate a Portal Connector form from the client side, using The Portal Connector API by simply passing the from name to the isFormValid() function, See Below:
Find & Find All
You can find all of The Portal Connector form widgets in the page by simply typing in “tpc.findAll()”.
You can also find a specific widget by simply typing in “tpc.find()” and passing the name of the widget.
Identity
You can also get the current logged in user's information by simply typing in “tpc.identity”.
Stay tuned for Part 3 of this Portal Connector Secrets blog series.