Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    José Luis Herranz
    @jherranzm
    I have printed all the properties of the object "button", in your case, but none of them was something like the "caller" or the "id" of the element clicked. Is there any way to pass this info and use it in the confirm method?
    userDotNetMVC
    @userDotNetMVC

    Hi @jherranzm this is how i solved this

    <script>
    $(document).ready(function () {
    var id;
    var deleteElement = null;
    $(".complexConfirm").click(function() {
    id = this.id;
    deleteElement = $(this).parent();
    // deleteElement = this.parent();
    });
    $(".complexConfirm").confirm({
    title: "Delete confirmation",
    text: "Are you sure you want to delete this file?",
    confirm: function (button) {
    $.ajax ({
    url: '/File/DeleteFile/'+id',
    contentType: 'application/json; charset=utf-8',
    async: true,
    processData: false,
    cache: false,
    success: function (data) {

                deleteElement.fadeOut(2000, function () {
                    $(this).remove();
                });
                id = null;
                deleteElement = null;
                //   $('#removeProject').modal('hide');
            }
        })
    
    },
    cancel: function (button) {
    
    },
    confirmButton: "Yes",
    cancelButton: "No"

    });
    });

    This message was deleted
    José Luis Herranz
    @jherranzm
    Hi @userDotNetMVC , thank you for your answer! So you have to create two functions, and always click function is performed before .confirm function. Am I right?
    I have also managed to get the id. I have realized that is there a property attr in your "button" object. When you call button.attr('id') you get the id you are looking for.
    ivanute
    @ivanute
    Hi there, I'm new here and I hope I'm following the right way for this issue
    I have successfully implemented jquery.confirm. The way it works for me is:
    Whenever the user click any link in my site that point outside my site (ex. apple.com) will pop up a dialog asking the user to confirm the action
    I would like to know if there is a way to open those links in new window/tab after user click OK in the confirmation dialog?
    Many thanks for your help!
    Matthieu Napoli
    @mnapoli
    @ivanute you would have to implement it manually using a handler (the confirm option)
    ivanute
    @ivanute
    Thank you very much @mnapoli Unfortunately my JS knowledge is very limited and I don't really know how to accomplish that.
    Would it be possible for you to orientate me a little bit more? Many thanks in advance.
    ivanute
    @ivanute
    Hi @mnapoli, hope you are well. I understand this is not easy to accomplish and you wouldnt be able to help me? Thanks anyway and sorry for asking too much.
    padgett59
    @padgett59
    i'm trying to use with MVC5 project
    just installed the libraries
    functions fine, but instead of a pretty modal dialogue it shows at the bottom of the page as unstyled div or something
    any help would be appreciated
    depeter
    @depeter
    you might be missing the bootstrap styling? Check whether the bootstrap.min.css file is loaded in the network tab of the developer tools (F12 in most browsers)
    Renan Serrão Nogueira
    @renanogueira
    Hi there
    Is there any way to centralize confirm box on the screen? Not at the top ..
    Matthieu Napoli
    @mnapoli
    hi, the confirm box is a bootstrap modal so have a look at Bootstrap if it's possible
    Renan Serrão Nogueira
    @renanogueira
    thanks!
    Paweł Adamczak
    @pawelad
    This message was deleted
    Hi! Love the simplicity, used the plugin before without a problem but I wanted to use it on form submit button and I can't get it working - any ideas whats wrong?
    <button type="submit" name="delete_from_group" class="btn btn-warning confirm-post" data-text="Website and its tests will still be in the database.">
        Delete from group
    </button>
    Matthieu Napoli
    @mnapoli
    @pawelad are you using the submitForm option?
    what is the JS code linked to this button?
    Paweł Adamczak
    @pawelad
    I tried using submitForm but it raises TypeError: Cannot read property 'value' of undefined, and from looking at the source code its not for this situation (it creates a form on the fly and not sends the existing one).
    JS code is a simple $(".confirm-post").confirm(); - I tried playing with post, submitForm and confirm but with no success
    Matthieu Napoli
    @mnapoli
    $(".confirm-post").confirm(); is just for links, I think submitForm is the option you need. It's been a while since I've had a look at the code so I can't help you much
    Paweł Adamczak
    @pawelad
    Sending a form on confirm was the closest I got but it created a problem with not knowing which button was pressed.
    $(".confirm-post").confirm({submitForm: true}); raises TypeError: Cannot read property 'value' of undefined here: https://github.com/myclabs/jquery.confirm/blob/master/jquery.confirm.js#L75
    Hm, but it should never go into that else
    OK, thanks for the help, I'll investigate further
    Matthieu Napoli
    @mnapoli
    agreed it shouldn't go into the else :/
    I don't have any idea to help sorry
    Paweł Adamczak
    @pawelad
    I got it to submit the form (via. data- and not initialization options), but as I feared - it doesn't send button name value : )
    Paweł Adamczak
    @pawelad
    If anyone else has the same problem - myclabs/jquery.confirm#65
    Sergio Cabral
    @sergioc6
    excuseme
    can I help me? with jquery.confirm
    Matthieu Napoli
    @mnapoli
    Yes, but only if you ask a question :)
    Guillaume
    @Deuteu
    @pawelad I've just submit PR#69 to fix your issue
    cc @mnapoli
    Matthieu Napoli
    @mnapoli
    :+1: I've just commented on it
    Guillaume
    @Deuteu
    To add some more information about my comment
    Guillaume
    @Deuteu
    @mnapoli Hi,
    About : https://github.com/myclabs/jquery.confirm/blob/master/jquery.confirm.js#L93
    Shouldn't be dataOptions after options ?
    Cause IMHO, dataOptions should be overriding options given that it's really related to only one element thus more specific.
    AnrietteC
    @AnrietteC
    Is it possible to use this as an alert with only one button?
    Guillaume
    @Deuteu
    Soon when I will update readme on my PR #71
    Guillaume
    @Deuteu
    @AnrietteC PR updated, you can take it from my repo before it is merged if you want to.
    webDEVILopers
    @webdevilopers
    I'm having some issues with confirm in older browser versions. Still waiting for feedback of my customer.
    Anyway it looks like the project is no longer maintained @mnapoli ? https://github.com/myclabs/jquery.confirm
    Matthieu Napoli
    @mnapoli
    @webdevilopers yes I don't have time to maintain it, if you want to be added as maintainer let me know
    webDEVILopers
    @webdevilopers
    Sorry @mnapoli but I'm not really into frontend :smile: Can you recommend any alternative?
    Guillaume
    @Deuteu
    Update your browser ? :trollface:
    More seriously, on which browser/version do you have some issues ?
    webDEVILopers
    @webdevilopers
    still waiting for the customer to respond. this demonstrates how important these issues are if the customer needs that long :)
    KawdaBoy21
    @KawdaBoy21
    :)