saribe / eModal

Easy Modal for bootstrap, is a simple way to create modal dialogs using javascript.
http://saribe.github.io/eModal
271 stars 97 forks source link

emodal alert help #31

Closed pbernim closed 8 years ago

pbernim commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

Hi,

Thanks a lot for your help!

That's what I need

Now it's work!

saribe commented 8 years ago

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

pbernim commented 8 years ago

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 commented 8 years ago

You can do it in multiple ways:

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

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

(.btn class)

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 https://github.com/saribe/eModal/issues/31#issuecomment-174514486.

saribe commented 8 years ago

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 https://github.com/saribe/eModal/issues/31#issuecomment-174514486.

saribe commented 8 years ago

[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 https://github.com/saribe/eModal/issues/31#issuecomment-174514486.

pbernim commented 8 years ago

Hi Samuel,

Thanks again for your time & valuable help.

vijay1189 commented 7 years ago

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 commented 2 years ago

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 commented 2 years ago

Hello take a look here http://saribe.github.io/eModal/#confirm

Hope it helps

Smiles, Samuel Pinto

On Tue, 20 Sept 2022, 09:05 Kevin Kidson, @.***> wrote:

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 ???"); } );

— Reply to this email directly, view it on GitHub https://github.com/saribe/eModal/issues/31#issuecomment-1251990195, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAUEJ5H2CIWNEMXHJO3SRDV7FV6JANCNFSM4BZOGPXQ . You are receiving this because you modified the open/close state.Message ID: @.***>

kidsonk commented 2 years ago

Many many thanks for getting back to me I have scoured that document before but cannot see where the actual value that is typed into the text box is returned As the text-box does not have an ID I have no idea how to get the value

On Fri, Sep 23, 2022 at 5:27 PM Samuel Pinto @.***> wrote:

Hello take a look here http://saribe.github.io/eModal/#confirm

Hope it helps

Smiles, Samuel Pinto

On Tue, 20 Sept 2022, 09:05 Kevin Kidson, @.***> wrote:

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 ???"); } );

— Reply to this email directly, view it on GitHub https://github.com/saribe/eModal/issues/31#issuecomment-1251990195, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABAUEJ5H2CIWNEMXHJO3SRDV7FV6JANCNFSM4BZOGPXQ

. You are receiving this because you modified the open/close state.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/saribe/eModal/issues/31#issuecomment-1256360184, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDJABCQMULMCEIB4UNVTU3V7XD7VANCNFSM4BZOGPXQ . You are receiving this because you commented.Message ID: @.***>