Custom widget get current page.

Hello everyone, I am building my first widget and I have a problem finding a way to get the current page ( the page on which the widget is placed ). Also, is it possible to add a Page parameter to the widget? Edit: Can the widget "show" a Page if you have that page name as a string?
3 answers

Hi Volen,

Get the Current Page Name: as Rom suggests, you can get the current page through _formBase and path, or you can use a property of (`mx.router`) and use:

mx.router._contentForm.path // --> "Administration/"

Include a Page as a Widget Property: In the documentation for the widget specification, you can see that you can include a Form property, which translates into the same name that you see in (`path`). In your widget, this translates into a property that lets the Mendix developer choose the page through a dialog, and whose key in your widget instance will map to a string value similar to what you see in (`path`), i.e. something like "Administration/". You can use that value in conjunction with (`mx.ui`) in the Client API to open forms through JS, like this:

mx.ui.openForm("MyFirstModule/", {
    location: "popup",
    callback: function(form) {



Hi Volen,

Regarding your second question you can send a string parameter to the widget, then it is up to the person who places the widget on a certain page to set that parameter correctly. If you want to open a page from the widget it best to use a microflow. You can set a microflow as a parameter and open a page in this microflow.

Hope this helps,



It should be pretty easy to find. If you look at the documentation, more specifically here, you will see that your widget (through _WidgetBase) has a member mxform of type _FormBase and _FormBase has a member path which contains the page.