Alert messages on changing screen access

Hi,

I have a small application. I have two features for instance, NEW and SEARCH. When a user presses NEW, he's supposed to enter around 14 entries in the form. Now, let's take he entered 8 entries and switches to SEARCH button. I want an alert message to be shown to the user that, if he leaves the page and doesn't SAVE the information, the information entered by him will be lost.

How do I put this functionality in place?

Thanks, Pragati