jQuery UI Dialog pass on variables

Posted by Dante on Stack Overflow See other posts from Stack Overflow or by Dante
Published on 2010-04-15T08:45:37Z Indexed on 2010/04/15 8:53 UTC
Read the original article Hit count: 892

Filed under:
|
|

Hi, I'm creating a Web interface for a table in Mysql and want to use jQuery dialog for input and edit. I have the following code to start from:

    $("#content_new").dialog({
    autoOpen: false,
    height: 350,
    width: 300,
    modal: true,
    buttons: {
        'Create an account': function() {
            alert('add this product');
        },
        Cancel: function() {
            $(this).dialog('close');
            $.validationEngine.closePrompt(".formError",true);
        }
    },
    closeText: "Sluiten",
    title: "Voeg een nieuw product toe",
    open: function(ev, ui) { /* get the id and fill in the boxes */ },
    close: function(ev, ui) { $.validationEngine.closePrompt(".formError",true); }
});
$("#newproduct").click(function(){
    $("#content_new").dialog('open');
});
$(".editproduct").click(function(){
    var test = this.id;
    alert("id = " + test);
});

So when a link with the class 'editproduct' is clicked it gets the id from that product and I want it to get to the open function of my dialog.

Am I on the right track and can someone help me getting that variable there.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about jquery-ui

Related posts about dialog