For some reason everything works with my code but the form will not submit.

```
$(function(){

            $("#dialog").dialog({
                    autoOpen:false,
                    bgiframe: true,
                    resizable: false,
                    //height:auto,
                    width:500,
                    modal: true,
                    overlay: {
                        backgroundColor: '#000',
                        opacity: 0.5
                    },
                    buttons: {
                        'I Agree': function() {
                            $(this).dialog('close');
                            $('#form1').submit()                    

                        },
                        'I Do Not Agree': function() {
                            $(this).dialog('close');
                            return false;
                        }
                    }
                });

            $("#submit").click(function(){

                $("#dialog").dialog('open');

            });
        });

```