diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js index 16085c4b777..90f59b1f899 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js @@ -276,7 +276,7 @@ stepForwardFrom["policy-type"] = function () { var correctiveActionList = []; if (policy.type === "GENERAL") { var selectedCorrectivePolicyId = $("#corrective-policy-input").val(); - if (selectedCorrectivePolicyId !== "none") { + if (selectedCorrectivePolicyId && selectedCorrectivePolicyId !== "none") { var correctiveAction = { "actionType": "POLICY", "policyId": selectedCorrectivePolicyId diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.js index 1474a895cfc..be04a6aa7c3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.js @@ -35,6 +35,7 @@ function onRequest(context) { var deviceType = request.getParameter("deviceType"); + var policyId = request.getParameter("id"); var utility = require("/app/modules/utility.js").utility; var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"]; @@ -84,7 +85,18 @@ function onRequest(context) { var enrollmentApps = policyModule.getStoreAppsForPolicy(); context["storeApps"] = JSON.stringify(enrollmentApps["content"]); - context["correctivePolicies"] = JSON.stringify(policyModule.getAllPoliciesByType("CORRECTIVE")["content"]); + var correctivePolicies = policyModule.getAllPoliciesByType("CORRECTIVE")["content"]; + if (correctivePolicies) { + var i; + for (i = 0; i < correctivePolicies.length; i++) { + if (correctivePolicies[i].id.toString() === policyId) { + correctivePolicies.splice(i, 1); + break; + } + } + } + + context["correctivePolicies"] = JSON.stringify(correctivePolicies); return context; } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js index eabcfbca386..061b02b0c4f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js @@ -282,7 +282,7 @@ stepForwardFrom["policy-profile"] = function () { } var policyType = currentlyEffected.policyType; - $("input[name=policy-type-radio-btn][value=" + policyType + "]").prop("checked", true); + $("input[name=policy-type-radio-btn][value=" + policyType + "]").prop("checked", true).trigger('change'); // add policy correction action page if (!isCorrectiveActionProfileAdded) { @@ -336,7 +336,7 @@ stepForwardFrom["policy-type"] = function () { var correctiveActionList = []; if (policy.type === "GENERAL") { var selectedCorrectivePolicyId = $("#corrective-policy-input").val(); - if (selectedCorrectivePolicyId !== "none") { + if (selectedCorrectivePolicyId && selectedCorrectivePolicyId !== "none") { var correctiveAction = { "actionType": "POLICY", "policyId": selectedCorrectivePolicyId