Leave Page Alert "warning " Unless Submit Button Clicked
You can use the dirty forms module.

Currently there is only a drupal 6 version on the project page, however in this issue there is a drupal 7 version that apparently has been well tested and works.

With this module you can configure it to target your form using css seletors like classes and ids.