jQuery UI - Form input return confirm to delete

jQuery UI - Form input return confirm to delete

I have the following form:

  1. <form action="delete.php" method="post">
  2. <input type="hidden" name="id" value="<{$pid}>" />
  3. <input type="hidden" name="picture" value="<{$lang_del_pic}>" />
  4. <input type="image" src="<{xoImgUrl}>img/del-icon.gif" width="16" height="16" align="bottom" border="0" alt="Delete media" name="pictured" value="<{$lang_del_pic}>" onclick="javascript: return confirm('<{$lang_confirm_del}>');" />
  5. </form>

which calls standard confirmation window to delete file. Now I want it to be jQuery modal confirmation pop-up. I manage to call the popup, and it all works, but when I hit, [B]"Confirm Delete" [/B]button - nothing happens - nothing ! Here is my scripts and new from:

  1. <form name="dialog-confirm"  id="dialog-confirm" method="post">
  2. <input type="hidden" name="id" value="<{$pid}>" />
  3. <input type="hidden" name="picture" value="<{$lang_del_pic}>" />
  4. <input type="image" src="<{xoImgUrl}>img/del-icon.gif" width="16" height="16" align="bottom" border="0" alt="Delete media" name="pictured" value="" id="opener"  />
  5. </form>

and the script:

  1. <script type="text/javascript">
  2.  $(function() {
  3.   // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
  4.   $("#dialog").dialog("destroy");
  5.   $("#dialog-confirm").html('This dialog will show every time!'); 
  6.   $("#dialog-confirm").dialog({
  7.    autoOpen: false,
  8.    title: 'Kur za berbatov',
  9.    resizable: false,
  10.    height:140,
  11.    modal: true,
  12.    buttons: {
  13.     'Delete all items': function() {
  14.      document.location = 'delete.php';
  15.     },
  16.     Cancel: function() {
  17.      $(this).dialog('close');
  18.     }
  19.    }
  20.   });
  21.   $('form#dialog-confirm').submit(function(){
  22.             $("input#pictured").html($("input#pictured").val());
  23.             $('#dialog').dialog('open');
  24.             return false;
  25.         });
  26.   $('input#opener').click(function() {
  27.    $('#dialog-confirm').dialog('open');
  28.   });
  29.  });
  30.  </script>

I have replaced    document.location = 'delete.php'; with $('#dialog-confirm').submit();  and even tried this: document.dialog-confirm.submit(); but still nothing...

Can anyone help here ?