As of you comment, one solution would be the use of - for example - jQuery to build a modal form. jQuery was the first JavaScript library that came to my mind, you could use any other (like MooTools or YUI). Just pick your favorite one :)
To implement this in Rails, have a look onto this gem