views:

40

answers:

1

well i'm back... i'm trying to make jquery UI's button and dialog plugins work with my form. i want the reset button

<button id="opener" value="reset" type="submit">Reset</button>

to pull up a confirmation dialog, which it does. cancel should dismiss dialog and set the button back to its original state. it dismisses fine but the button maintains its hover state, even though i have tried adding the .refresh method just about everywhere i can think of.

jQuery(document).ready(function($) {

$(".dialog").dialog({
            autoOpen: false,
            resizable: false,
            modal: true,
            title: 'Warning!',
            close: function () {
                $('#opener').button('refresh');
                },
            buttons: {
                'Continue': function() {
                    $(this).dialog('close');    
                },
                Cancel: function() {
                    $(this).dialog('close');
                    $('#opener').button('refresh')
                }
            }
        });


$('#opener').click(function() {
            $('.dialog').dialog('open');
            $(this).button('refresh')
            return false;
        });
});

then on a Continue response the button should continue with its original purpose.. which doesn't happen. i get a return: false type of behavior w/o return: false anywhere.

A: 

someone at the jquery forum answered me that for the first part i need to add

close: function () {
$('#opener').removeClass('ui-state-focus');
},

to the dialog commands. and

$('#myform').submit();

to the the continue function

helgatheviking