Pop-up message on button - Widget

Leonardo Chavez
Kilo Contributor

Hi SNow experts,

Is there a way to add a pop-up message or a modal window when i clic the submit button?

Note: It's a widget.


find_real_file.png

Thanks in forwards,
Leo

1 ACCEPTED SOLUTION

@Leonardo Chavez I suggested the exact solution of what you are looking for but not use why it was not marked as correct, is there any issue still you are facing? 

View solution in original post

6 REPLIES 6

Raghu Ram Y
Kilo Sage

Hi @Leonarda Chavez 

Yes, we can do.. I am sharing some code..modify according to your requirement.

HTML

<div>
<button type="button" ng-click = "c.submit()" class="btn btn-success pull-right" >Submit</button>
</div>

Client

c.submit= function(){
spModal.open({
            title: 'Are you sure you want to submit?',
            message: 'Type YES',
            input: true,
        }).then(function(name) {
         c.data.updateComment= name;
	 c.server.update();
    })

Leonardo Chavez
Kilo Contributor

Hi @Raghu Ram,

Thanks but im still getting no message, probably i estructure it wrong.

HTML Template
<input class=input type="submit" value="Submit" ng-click="c.changed()">
Client Script
c.changed = function() {
	spModal.open({
            title: 'Test',
            message: 'This is a test'
        });

Hi.. After clicking on submit button what you want to do? Let me know so that I can share the same script for you

Raghu Ram Y
Kilo Sage

@Leonardo Chavez  I understand ur requirement just replace your client script like below.

api.controller = function(spUtil, $scope, spModal) {\
    var c = this;
    c.changed = function() {
        c.confirmed = "asking";
        spModal.confirm("Are you sure to submit this?").then(function(confirmed) {
            c.confirmed = confirmed; // true or false
        });
};

I hope it definitely helps you, if so please mark my response as both correct and helpful.