Multiple UI Dialogs, how to select/disable dialog button.

Multiple UI Dialogs, how to select/disable dialog button.

Scenario: I am creating a User/Group permissions manager for a client.  Selecting a group opens a modal dialog to edit the group as well as group memberships.  There is button that then opens another modal dialog to select a user/group to add.  Thus I have two dialog's stacked, both of which have 'Ok' and 'Cancel' buttons.  I would like to disable the 'Ok' button unless something is selected.
 
I can use the following to get all 'Ok' buttons:
 
  1. var test = $(".ui-dialog-buttonpane button:contains('Ok')");
 
But then that returns both dialogs (as well as other dialogs I have hidden for other operations).  As the buttonpane is not a child of the dialog div, I would have to find the dialog div's parent and then find the proper button (which I haven't been successful at yet).  Or iterate through each button's parents until I reach one that has the dialog as a child.  Is there a better way to accomplish this?
 
Workaround: Renaming every button to be unique ('Ok' becomes 'Add Member'), which I can then use the query from above.  That is all well and good, but becomes incrementally more difficult managing button names or if it does not make sense to have unique button names (two separate dialogs that have 'Add Member' for example).
 
Anthony