Hello everyone,
I am trying to make my own “Complete” Button in an embedded task form, in order to execute a script before submitting.
However, when I click the button nothing happens.
I am not very experienced in web developing, so I probably did a mistake in the html file.
Here is the end of the file with the function and the button :
If someone has a solution to my problem, please let me know.
Hello @whynotworking ,
I would like to refer to the lifecycle listeners that live inside the cam-script.
https://docs.camunda.org/manual/latest/reference/forms/embedded-forms/lifecycle/
What you then will do is looking at the submit
event and implement your script inside the listener function.
Hope this helps
Jonathan
1 Like
Hi @whynotworking,
Try below code
<form name="frmTest">
<script cam-script type="text/form-script">
inject([ '$rootScope', '$scope', 'Notifications', function($rootScope, $scope, Notifications) {
$scope.doComplete = function() {
// invoke complete() method
$scope.complete(Notifications.addMessage({
status: 'Successfully Submitted',
message: 'Form has been successfully submitted',
scope: $scope
}));
}
}]);
</script>
<div class="form-group">
<button type="button" class="btn btn-primary" type="submit" ng-click="doComplete()">Test Complete</button>
</div>
</form>
3 Likes
Hi @jonathan.lukas, thanks for your answer but I didn’t really explain my goal which is to do several submit button with different behaviors. I don’t think listeners are relevant for my situation.
Hi @hassang thanks for your answer, it seems to work !
1 Like