Forum: Ruby on Rails using js prompt() instead of a form with create method

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mk 2. (Guest)
on 2009-05-29 04:08
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?
Mk 2. (Guest)
on 2009-05-29 04:32
I am thinking it is actually impossible to pass a client side javascript
variable into the server side rails without hiding a form somewhere...
Rick D. (Guest)
on 2009-05-29 04:59
(Received via mailing list)
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
This topic is locked and can not be replied to.