Jason Crystal
2008-Oct-22 17:17 UTC
link_to_remote :confirm => as JavaScript function (dynamic)
Hey all,
Normally you can use the :confirm functionality of link_to_remote to
specify the text of a confirmation dialogue.
For example, :confirm => "hello" generate:
<a href="#" onclick="if (confirm(''hello'')) {
new Ajax.Request ...
I''d like to replace "hello" with a JavaScript call (so that
the
confirmation dialogue can contain text based on what a user has so far
done on the page. If I try to pre-emptively close the quote, it ends up
just getting escaped, and the function name is simply displayed:
:confirm => "''+myFunction()"
<a href="#" onclick="if
(confirm(''\''+myFunction()'')) { new Ajax.Request
...
Any idea how I might accomplish a dynamic confirmation dialogue?
Thanks!!
-Jason
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
mooseman
2008-Nov-19 17:27 UTC
Re: link_to_remote :confirm => as JavaScript function (dynamic)
Have you tried :before instead of :confirm You''ll have to do your own confirm dialog but your function can build the confirm string any way you want On Oct 22, 11:17 am, Jason Crystal <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hey all, > > Normally you can use the :confirm functionality of link_to_remote to > specify the text of a confirmation dialogue. > > For example, :confirm => "hello" generate: > <a href="#" onclick="if (confirm(''hello'')) { new Ajax.Request ... > > I''d like to replace "hello" with a JavaScript call (so that the > confirmation dialogue can contain text based on what a user has so far > done on the page. If I try to pre-emptively close the quote, it ends up > just getting escaped, and the function name is simply displayed: > > :confirm => "''+myFunction()" > <a href="#" onclick="if (confirm(''\''+myFunction()'')) { new Ajax.Request > ... > > Any idea how I might accomplish a dynamic confirmation dialogue? > > Thanks!! > -Jason > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---