Program enrollment validation and Program attributes custom control and default value

  1. I used the bahmni config js file to intercept the program enroll event and return an error if they wish to enroll a M patient like
$scope.enrollPatient = function () {
    if ($scope.patient.gender !== 'F' && $scope.programSelected.name === '<Program Name>') {
        messagingService.showMessage("error", "Only female patient can enroll to an ANC Program");
        return $q.when({});
    }
}
  1. I used the form condition of bahmni config to inject my javascript code to make the necessary validation on the program attributes
1 Like