Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emodal alert help #31

Closed
pbernim opened this issue Jan 25, 2016 · 12 comments
Closed

emodal alert help #31

pbernim opened this issue Jan 25, 2016 · 12 comments
Assignees
Labels

Comments

@pbernim
Copy link

pbernim commented Jan 25, 2016

Hi,

I don't know how the event works. The follow code does nothing.

What is wrong?

var options = {
message: "The famous question?",
title: 'Header title',
size: eModal.size.sm,
subtitle: 'smaller text header',
label: 'Yes',
callback: function(){alert(1);},
callbackCancel: function(){alert(2);}
};

    eModal.confirm(options);

Thanks

@saribe saribe self-assigned this Jan 25, 2016
@saribe
Copy link
Owner

saribe commented Jan 25, 2016

Hi, where did you get this example?

Events work as a promise!
Take a look:

var options = {
    message: "The famous question?",
    title: 'Header title',
    size: eModal.size.sm,
    subtitle: 'smaller text header',
    label: 'Yes'
};

eModal
   .alert(options)
   .then( 
       function(){ alert(1); },
       function(){ alert(2); }
   );

Hope that help, see more examples in example site Http://saribe.github.io/eModal

@pbernim
Copy link
Author

pbernim commented Jan 25, 2016

Hi,

Thanks a lot for your help!

That's what I need

Now it's work!

@saribe
Copy link
Owner

saribe commented Jan 25, 2016

NIce to know,
Please feel free to contact me if you need any further information.

@saribe saribe closed this as completed Jan 25, 2016
@pbernim
Copy link
Author

pbernim commented Jan 25, 2016

Thanks again for your help.

Another question:

How can I change the colour of the buttons?

I have by default:

Yes = blue
No = red

I need Yes = red

Thanks

var options = {
message: "Do you really want to delete this record?",
title: 'Confirmation',
size: eModal.size.sm,
label: 'Yes'
};

    eModal.confirm(options).then(
        function(){ alert(1); },
        function(){ alert(2); }
        );

@saribe
Copy link
Owner

saribe commented Jan 25, 2016

You can do it in multiple ways:

  • Query DOM and change it.
    • When you execute eModal.ACTION, it returns a promise and in the
      promise object, you will find the modal's DOM element.

e.g.; var promise = eModal
.confirm("Hello")
.then(OKfn, KOfn);

    promise.element.find(".btn"); <- this wil return a list of buttons

(.btn class)

  • Provide custom buttons.
    • If you provide your buttons in object options, you can define a
      class

      ,
      buttons: [
      { close: true, click: callback1, text: "btn-danger", style: "danger"
      },
      { close: true, click: callback2, text: "btn-info" style: "info" }, {
      close: true, click: callback3, text: "Other", style: " other" }, //<-
      notice the space before
      { close: true, click: callback4, text: "CSS", css: {
      background-color: 'pink', color: 'blue' } }
      ],

Samuel Ribeiro Pinto

2016-01-25 13:50 GMT+00:00 spilxx notifications@github.com:

Thanks again for your help.

Another question:

How can I change the colour of the buttons?

I have by default:

Yes = blue
No = red

I need Yes = red

Thanks

var options = {
message: "Do you really want to delete this record?",
title: 'Confirmation',
size: eModal.size.sm,
label: 'Yes'
};

eModal.confirm(options).then(
    function(){ alert(1); },
    function(){ alert(2); }
    );


Reply to this email directly or view it on GitHub
#31 (comment).

@saribe
Copy link
Owner

saribe commented Jan 25, 2016

Note: if the ACTION in use, already has buttons (e.g.: prompt), your
custom buttons will be addded on left, this will not replace the "native"
ones.

Samuel Ribeiro Pinto

2016-01-25 15:32 GMT+00:00 Samuel Pinto samuel@maispc.com:

You can do it in multiple ways:

  • Query DOM and change it.
    • When you execute eModal.ACTION, it returns a promise and in the
      promise object, you will find the modal's DOM element.

e.g.; var promise = eModal
.confirm("Hello")
.then(OKfn, KOfn);

    promise.element.find(".btn"); <- this wil return a list of buttons

(.btn class)

  • Provide custom buttons.
    • If you provide your buttons in object options, you can define a
      class

      ,
      buttons: [
      { close: true, click: callback1, text: "btn-danger", style:
      "danger" },
      { close: true, click: callback2, text: "btn-info" style: "info" }, {
      close: true, click: callback3, text: "Other", style: " other" },
      //<- notice the space before
      { close: true, click: callback4, text: "CSS", css: {
      background-color: 'pink', color: 'blue' } }
      ],

Samuel Ribeiro Pinto

2016-01-25 13:50 GMT+00:00 spilxx notifications@github.com:

Thanks again for your help.

Another question:

How can I change the colour of the buttons?

I have by default:

Yes = blue
No = red

I need Yes = red

Thanks

var options = {
message: "Do you really want to delete this record?",
title: 'Confirmation',
size: eModal.size.sm,
label: 'Yes'
};

eModal.confirm(options).then(
    function(){ alert(1); },
    function(){ alert(2); }
    );


Reply to this email directly or view it on GitHub
#31 (comment).

@saribe
Copy link
Owner

saribe commented Jan 25, 2016

[image: Imagem intercalada 2]

Samuel Ribeiro Pinto

2016-01-25 15:35 GMT+00:00 Samuel Pinto samuel@maispc.com:

Note: if the ACTION in use, already has buttons (e.g.: prompt), your
custom buttons will be addded on left, this will not replace the "native"
ones.

Samuel Ribeiro Pinto

2016-01-25 15:32 GMT+00:00 Samuel Pinto samuel@maispc.com:

You can do it in multiple ways:

  • Query DOM and change it.
    • When you execute eModal.ACTION, it returns a promise and in the
      promise object, you will find the modal's DOM element.

e.g.; var promise = eModal
.confirm("Hello")
.then(OKfn, KOfn);

    promise.element.find(".btn"); <- this wil return a list of

buttons (.btn class)

  • Provide custom buttons.
    • If you provide your buttons in object options, you can define a
      class

      ,
      buttons: [
      { close: true, click: callback1, text: "btn-danger", style:
      "danger" },
      { close: true, click: callback2, text: "btn-info" style: "info" }, {
      close: true, click: callback3, text: "Other", style: " other" },
      //<- notice the space before
      { close: true, click: callback4, text: "CSS", css: {
      background-color: 'pink', color: 'blue' } }
      ],

Samuel Ribeiro Pinto

2016-01-25 13:50 GMT+00:00 spilxx notifications@github.com:

Thanks again for your help.

Another question:

How can I change the colour of the buttons?

I have by default:

Yes = blue
No = red

I need Yes = red

Thanks

var options = {
message: "Do you really want to delete this record?",
title: 'Confirmation',
size: eModal.size.sm,
label: 'Yes'
};

eModal.confirm(options).then(
    function(){ alert(1); },
    function(){ alert(2); }
    );


Reply to this email directly or view it on GitHub
#31 (comment).

@pbernim
Copy link
Author

pbernim commented Jan 25, 2016

Hi Samuel,

Thanks again for your time & valuable help.

@vijay1189
Copy link

vijay1189 commented Jun 14, 2017

Hi saribe,
I am using eModal,
i had one issue, after turboboost transaction (on clicking on the turboboost link), emodal is not working,
i tried from even browser console also eModal.alert(''), but it didnt worked.
please can u help me on this.

Thanks

@kidsonk
Copy link

kidsonk commented Sep 20, 2022

Am I being stupid but I cannot see any way to get the value that is typed into the prompt box. it has no id so I don't know how to reference it. Any help very much appreciated.
eModal.prompt(options)
.then(
function () { alert("?? PROMPT VALUE ???"); }
);

@saribe
Copy link
Owner

saribe commented Sep 23, 2022 via email

@kidsonk
Copy link

kidsonk commented Sep 26, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants