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.
68814ed988eee4f21b2cd07353e5e445?d=identicon&s=25 Mk 27 (mk27)
on 2009-05-29 02: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?
68814ed988eee4f21b2cd07353e5e445?d=identicon&s=25 Mk 27 (mk27)
on 2009-05-29 02: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...
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2009-05-29 02:59
(Received via mailing list)
On Thu, May 28, 2009 at 8:32 PM, Mk 27
<rails-mailing-list@andreas-s.net> 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.