Problem sending a form via a confirmation dialog.

Problem sending a form via a confirmation dialog.

Hi.

I want to send a form to the button plusar presented by a confirmation dialog in jQuery. The problem I pick well hidden variables but not the one that comes in the submit button type.

Can you help?
I'm blocked.
Thanks and best regards.




This is mi complete example sample code:

<?php
$cmd = $_REQUEST['cmd'];   
$res = $_REQUEST['res'];
echo "PARAM=$cmd";
echo "<br>";
echo "RES=$res";
echo "<br>";
echo "<br>";

?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Forms in ui Dialog</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/redmond/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
    <link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css" />
<script>
$(document).ready(function(){
        var dialogOpts = {
          bgiframe: true,
          modal: true,
          overlay: {
                    backgroundColor: '#000',
                    opacity: 0.5
                },
            buttons: {
                "Delete all items": function() {
                    $("#form1").submit();
                    $("#myDialog").dialog("close");
                    return true;
                },
                Cancel: function() {
                    $("#myDialog").dialog("close");
                }
            },
          autoOpen: false,
        };
        $("#myDialog").dialog(dialogOpts);
        $("#btopenDial").click(function(e) {
        //$("#btopenDial").bind('click', function(e){
             e.preventDefault();
              e.stopPropagation();
          $("#myDialog").dialog("open");
           //return true;
        }); 
    });
</script>
</head>
<body>
<form id="form1" NAME='form1' method='post' ACTION='formdialog2?cmd=<? echo $cmd; ?>' enctype='application/x-www-form-urlencoded'>
<input type='hidden' value='change' name='res'>
    <button type='submit' id='btopenDial' name='cmd'  value='delbutton' >Enviar</button>

</form>
<div id="myDialog" title="Cabecera Dialog">
    Los recursos seleccionado van a ser eliminados!
</div>
</body>
</html>