// -- Attribute Information -- // webFormElement = the form where the button will be displayed in // existingButtonId = button that exist and the new button will be rendered next to it // webPagePartialUrl = web page that hosts the form for example (ControlledOresApplicationEditWebPage) addExitButtonToWebForm: function (webPagePartialUrl, webFormPanelId, existingButtonId, newButtonId, newButtonText, newButtonClickFunction) { if ($("form").attr("action") !== undefined && $("form").attr("action").indexOf(webPagePartialUrl) !== -1) { $("#" + webFormPanelId).find("#" + existingButtonId).after( ''); $("#" + newButtonId).click(function () { newButtonClickFunction(); }); } }, addConfirmDialogModal: function (buttonId, modalTitle, modalBody, yesButtonCallback) { var modalId = buttonId + "Modal"; var yesButtonId = modalId + "YesButton"; if ($("form").find("#" + modalId).html() === undefined) { $("form") .after(''); $("#" + buttonId).attr('data-toggle', 'modal'); $("#" + buttonId).attr('data-target', '#' + modalId); $("#" + yesButtonId).click(function (e) { yesButtonCallback(e); $('#' + modalId).modal('hide'); }); } } }; ///////////////////////END Of JS Helper////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// //================//============================//========================= //////this will run on all the forms for all pages $(document).ready(function () { RES.PortalHelper.addExitButtonToWebForm("ControlledOresApplicationEditWebPage", "WebFormPanel", "PreviousButton", "exitControlledOres", "Exit", function (e) { e.preventDefault(); }); RES.PortalHelper.addConfirmDialogModal("exitControlledOres", "Exit Application", "Are you sure you want to exit this application ?", function () { window.location.href = "/ControlledOresApplicationList/"; }); });