I''ve just started using RJS and I''m having a fundamental
problem.
All of my RJS statements are showing as unexecuted Javascript.
I could have something like:
<%= render :update do |page|
page.alert "Hello"
end
%>
But, instead of an alert window I get a string in the browser:
alert("Hello");
This occurs whether I''m using Safari or Firefox or whether I put the
code in the controller or in an .rjs file. I''m using Rails
Can anyone help point me to a solution?
Thank you,
Jose
.......................................................
Jose Hales-Garcia
UCLA Department of Statistics
jose-oNoWckAxTcaFhjwBz98joA@public.gmane.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
On Mar 25, 7:06 am, Jose Hales-Garcia <j...-oNoWckAxTcaFhjwBz98joA@public.gmane.org> wrote:> This occurs whether I''m using Safari or Firefox or whether I put the > code in the controller or in an .rjs file. I''m using RailsI left out an important fact, I''m calling the RJS from a file without a layout (render :layout => false). I think that''s causing the problem, because I can get RJS working in laid out pages. The RJS call is occurring in the result page returned by an observed_field action. I need to update HTML on the page whenever the observed_field is altered. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
You need to wrap the snippet that render(:update) generates with a
script tag. Try
<%= javascript_tag render :update do |page|
page.alert ''hi''
end %>
Or:
<%= update_page_tag do |page|
page.alert(''hi'')
end %>
On Mar 25, 10:06 pm, Jose Hales-Garcia
<j...-oNoWckAxTcaFhjwBz98joA@public.gmane.org>
wrote:> I''ve just started using RJS and I''m having a fundamental
problem.
> All of my RJS statements are showing as unexecuted Javascript.
>
> I could have something like:
>
> <%= render :update do |page|
> page.alert "Hello"
> end
> %>
>
> But, instead of an alert window I get a string in the browser:
>
> alert("Hello");
>
> This occurs whether I''m using Safari or Firefox or whether I put
the
> code in the controller or in an .rjs file. I''m using Rails
>
> Can anyone help point me to a solution?
>
> Thank you,
> Jose
>
> .......................................................
> Jose Hales-Garcia
> UCLA Department of Statistics
> j...-oNoWckAxTcaFhjwBz98joA@public.gmane.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---