button_to_function and javascript prompt?

Well, that will do it. What do you want to do with the answer?

I suggest you put the results of prompt() into a (js) variable and then pass it to the server through an Ajax.Request. You can use the Rails remote_function() helper to write the js for that. Use the :with option to pass the js variable.

Here's an example from an app of mine:

<%= javascript_tag %Q{   function x_add_task()   {     var name = prompt('Name for new task', '');     if (name == null) return;     #{remote_function :url => {:action => 'x_add_task', :id => @obj.id}, :with => "'name=' + name" }   } } %>

Then later:

<%= link_to_function 'Add Task', 'x_add_task()' %>