Using js prompt() instead of a form with create method


#1

I have a new/create method that only has one field, and I’d rather use a
js prompt() to get the data instead of a form.

The trigger for this is not a link, it’s a span. Using “onclick” in the
span, how can I call a prompt(), return the single param to the
contoller “create” method, and then call the controller “list” method to
update the page?


#2

I am thinking it is actually impossible to pass a client side javascript
variable into the server side rails without hiding a form somewhere…


#3

On Thu, May 28, 2009 at 8:32 PM, Mk 27
removed_email_address@domain.invalid wrote:

I am thinking it is actually impossible to pass a client side javascript
variable into the server side rails without hiding a form somewhere…

Well you can make an Ajax request, and pass the value of the
javascript variable in a query parameter in the url.


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale