- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2019 01:22 AM
Hello,
I'm trying to handle the same thing but unfortunately my pop-up window is not called.
You will find my script below:
HTML Template:
<div class="btn_save">
<button type= "submit" class = "button" class="save_form" onClick="clickMethod()">Save</button>
</div>
Client Script:
function clickMethod() {
alert("Function called");
if(confirm("Are you sure to delete ?")) {
console.log("Implement save functionality here");
}
}
I'm trying in this step to check if the call is working and run the function to display the 'alert' message. Any idea why the function is not called ?
FYI: When I use the 'alert('There is the alert') in the button html balise, the message is showing up, so I'm pretty sure that is coming from the 'client script' side and not form the html part.
Many thanks for your help !
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2019 02:13 AM
Try this
HTML
<div class="btn_save">
<button type= "submit" class = "button" class="save_form" ng-click="clickMethod()">Save</button>
</div>
Client script
function($scope) {
/* widget controller */
var c = this;
$scope.clickMethod = function () {
alert("Function called");
if(confirm("Are you sure to delete ?")) {
console.log("Implement save functionality here");
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2019 02:13 AM
Try this
HTML
<div class="btn_save">
<button type= "submit" class = "button" class="save_form" ng-click="clickMethod()">Save</button>
</div>
Client script
function($scope) {
/* widget controller */
var c = this;
$scope.clickMethod = function () {
alert("Function called");
if(confirm("Are you sure to delete ?")) {
console.log("Implement save functionality here");
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2019 06:40 AM
spModal has a confirm method you can use also
function($scope, spModal) {
spModal.confirm("Are you sure you wish to copy this?").then(function(confirmed) {
if(confirmed){
//Your code if confirmed.
}
})
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2019 10:18 AM
Thank you for your return,
Now, I'm trying to run the function regarding the action button selected:
c.clickMethodSave = function(){
spModal.open({
title: 'Save Window',
widget: 'b1691378db5180108fe230d8689619a6',
buttons: [
{label: '${Yes}', yes: true},
{label:'${No}', cancel: false}
]
}).then(function(){
//if (yes selected) {then ...}
//if (no selected) {then ...}
})
How can I handle the both condition ? Or more exactly where is the boolean set once the button is selected ?