jQuery UI - Form input return confirm to delete
I have the following form:
- <form action="delete.php" method="post">
- <input type="hidden" name="id" value="<{$pid}>" />
- <input type="hidden" name="picture" value="<{$lang_del_pic}>" />
- <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}>');" />
- </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:
- <form name="dialog-confirm" id="dialog-confirm" method="post">
- <input type="hidden" name="id" value="<{$pid}>" />
- <input type="hidden" name="picture" value="<{$lang_del_pic}>" />
- <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" />
- </form>
and the script:
- <script type="text/javascript">
- $(function() {
- // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
- $("#dialog").dialog("destroy");
- $("#dialog-confirm").html('This dialog will show every time!');
- $("#dialog-confirm").dialog({
- autoOpen: false,
- title: 'Kur za berbatov',
- resizable: false,
- height:140,
- modal: true,
- buttons: {
- 'Delete all items': function() {
- document.location = 'delete.php';
- },
- Cancel: function() {
- $(this).dialog('close');
- }
- }
- });
- $('form#dialog-confirm').submit(function(){
- $("input#pictured").html($("input#pictured").val());
- $('#dialog').dialog('open');
- return false;
- });
- $('input#opener').click(function() {
- $('#dialog-confirm').dialog('open');
- });
- });
- </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 ?