One or two dialog instances for adding and editing?

is better to create two dialog instance, one for adding and one for editing, or is it possible to use one dialog?

Ex This is what I am currently using

        // Add Dialog
        $  ('#addProgramDialog').dialog({
            autoOpen: false,
            width: 400,
            height: 500,
            title: 'Add Program',
            buttons: {
                'Cancel': function () {
                    $  (this).dialog('close');
                },
                'Save': function () {
                    saveProgramRequest();
                }
            }
        });

        // Edit Dialog
        $  ('#editProgramDialog').dialog({
            autoOpen: false,
            width: 400,
            height: 500,
            title: 'Edit Program',
            buttons: {
                'Cancel': function () {
                    $  (this).dialog('close');
                },
                'Update': function () {
                    updateProgramRequest();
                }
            }
        });

newest questions tagged jquery – Stack Overflow

About Admin