confirming (via javascript) before save

Hello all,

I have the following scenario. The user will input a name for the student to be added, since you can have duplicate names, the user will be the one in charge of checking if he is not adding the same student two times. There are other fields that can be used in order to check it, but it has to be done manually.

The point is, when the user clicks on the submit button, I want to check if a user with the same name already exists and, if so, prompt a confirm window (javascript) to the user, so that he makes sure of what he is doing.

What is the best way to do it? Inside the create method of the controller?

Thank youvery much

cheers!