Ajax dialog button handling should be more flexible