# Confirming (via javascript) before save

**URL:** <https://www.ruby-forum.com/t/confirming-via-javascript-before-save/157457>\
**Category:** Rails\
**Created:** [January 11, 2009, 3:07pm UTC](https://www.ruby-forum.com/t/confirming-via-javascript-before-save/157457 "2009-01-11T15:07:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![felipegiotto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/13edae/32.png) [@felipegiotto](https://www.ruby-forum.com/u/felipegiotto)\
**Post date:** [January 11, 2009, 3:07pm UTC](https://www.ruby-forum.com/t/confirming-via-javascript-before-save/157457/1 "2009-01-11T15:07:49Z")

</div>

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!

–  
gallois  
aka Felipe G.  
blog: www.gallois.com.br/blog  
fanglib homepage: www.gallois.com.br/fanglib
