Creating a simple Cancel Custom Widget

Hi there,

I’m trying to create a simple Cancel Custom Widget for use in Instantiation forms, for when a user realizes they don’t want to do the process…

My template is:

Cancel

and my controller is:

function($scope, $window){ console.log("Doing it anyway!"); //#1
 $scope.onClick = function cancelOnClick($scope, $window) {
    console.log("cancelling!"); //#2
    $window.top.location.href = '/' + $scope.properties.bonitaWebAppName;
};

}

with one property:

bonitaWebAppName Label: Bonita web app name Treat as Dynamic value Type: text Default value: bonita

When I execute the process I always get the “Doing it anyway!” //#1 message but when I click the Button it never seems to fire…

I’m trying to learn angularjs but, it’s not that easy… :slight_smile:

Thanks for the advice in advance,

regards
Sean

Update:

I’ve now seen how to do it…

Cancel

with controller:

function($scope, $window){ console.log("Doing it anyway!");
 this.onClick = function cancelOnClick() {
    console.log("cancelling!");
    $window.top.location.href = '/' + $scope.properties.bonitaWebAppName;
};

}

But it still doesn’t work…

OK, in the end I worked it out.

Don’t use a DIV around the button…

So my final code for the Cancel button template is

Cancel

and the Controller

function($scope, $window){ this.cancelOnClick = function () { $window.top.location.href = '/' + $scope.properties.bonitaWebAppName; }; }

I’ve used the parameter as well

bonitaWebAppName Label: Bonita web app name Treat as Dynamic value Type: text Default value: bonita

Bonita web app name: the name of Bonita Portal web application. By default “bonita”. This will be used to build REST API URL but also to redirect user to Portal welcome page if no tasks are available

Hope it helps others
regards
Sean