Hi all,
Im trying to implement redbox for submitting some small forms. Here''s
the code im using.
#redbox link
<%= link_to_remote_redbox ''Change Password'', :url =>
{:controller
=> :users, :action => :change_password, :id => @user.id}, :method
=> :get %>
#users controller
  def change_password
    @user = User.find(params[:id])
    respond_to do |format|
      format.html
      format.js {render :layout => "modal"}
    end
    rescue ActiveRecord::RecordNotFound
      permission_denied
  end
#modal layout
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Invoicing</title>
	<link rel="stylesheet" href="/stylesheets/styles.css"
type="text/css"
media="screen" charset="utf-8" />
	<%= javascript_include_tag :defaults %>
        <%= javascript_include_tag "redbox"%>
</head>
<body>
		<%= yield %>
</body>
</html>
#change_password.js.erb
<div
id="hidden_content_<%=@user.id%>_users_change_password">
<% form_for :user, :url => changed_password_user_path(@user), :html =>
{:method => ''put''} do |f| %>
	<div>Old	: <%= f.password_field :old_password, :size => 15
%></div>
	<div>New  : <%= f.password_field :password, :size => 15
%></div>
	<div>Confirm     : <%= f. password_field :confirm_password, :size
=>
15 %></div>
	<p><%= f.submit "Change" %></p>
<% end %>
<%= link_to_close_redbox "Cancel" %>
</div>
Now when i click the link, the RedBox Overlay is shown but the form
does not turn up. Only the overlay is shown. If i check the dev log,
it says the action has been successfully called and the rendering has
been done.
What am i doing wrong here? Any ideas?
My best guess is that the JS is screwing up things somewhere. Or, I
could be doing something basically very wrong.. :D
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Hi all,
Im trying to implement redbox for submitting some small forms. Here''s
the code im using.
#redbox link
<%= link_to_remote_redbox ''Change Password'', :url =>
{:controller
=> :users, :action => :change_password, :id => @user.id}, :method
=> :get %>
#users controller
  def change_password
    @user = User.find(params[:id])
    respond_to do |format|
      format.html
      format.js {render :layout => "modal"}
    end
    rescue ActiveRecord::RecordNotFound
      permission_denied
  end
#modal layout
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Invoicing</title>
	<link rel="stylesheet" href="/stylesheets/styles.css"
type="text/css"
media="screen" charset="utf-8" />
	<%= javascript_include_tag :defaults %>
        <%= javascript_include_tag "redbox"%>
</head>
<body>
		<%= yield %>
</body>
</html>
#change_password.js.erb
<div
id="hidden_content_<%=@user.id%>_users_change_password">
<% form_for :user, :url => changed_password_user_path(@user), :html =>
{:method => ''put''} do |f| %>
	<div>Old	: <%= f.password_field :old_password, :size => 15
%></div>
	<div>New  : <%= f.password_field :password, :size => 15
%></div>
	<div>Confirm     : <%= f. password_field :confirm_password, :size
=>
15 %></div>
	<p><%= f.submit "Change" %></p>
<% end %>
<%= link_to_close_redbox "Cancel" %>
</div>
Now when i click the link, the RedBox Overlay is shown but the form
does not turn up. Only the overlay is shown. If i check the dev log,
it says the action has been successfully called and the rendering has
been done.
What am i doing wrong here? Any ideas?
My best guess is that the JS is screwing up things somewhere. Or, I
could be doing something basically very wrong.. :D
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
link_to_redbox works though.
#link_to_redbox link
#in the view with the above link
<div id="rb_test" style="display:none;">
       watsup?
      <%= link_to_close_redbox "Cancel" %>
</div>
This shows a white box in the center, slightly above center. The
spinner.gif does not get hidden even after "watsup?" is rendered. and
"watsup?" is rendered at the very bottom of the white box and a little
outside it too.
When I use link_to_remote_redbox to render the form, in FF, I tried
selecting an arbitrary part of the result (which is just the black
transparent RB_overlay) and viewing source.
that shows the elements of the form and their full details but whats
selected is only the source for the RB_overlay div. So im guessing the
form is rendered but im not able to see it for some reason.
Another interesting thing is that when i click on "View source" for
that arbitrary selection as described above, Firebug throws an error
at the element.hide() function source code. The error message itself
is VERY long and highly truncated so im not pasting it here but will
try it if anyone thinks itll help. Firebug throws this error when i
click on "View source".
Could this element.hide() error and the spinner not hiding after
rendering "watsup?" have some connection?
getting a bit desperate here.. all other options for a modal form seem
more complicated so I want to make sure im not making a silly mistake
before I jump into trying the other solutions.
On Mar 18, 5:00 pm, Ram
<yourstruly.vi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi all,
>
> Im trying to implementredboxfor submitting some small forms.
Here''s
> the code im using.
>
> #redboxlink
> <%= link_to_remote_redbox ''Change Password'', :url
=> {:controller
> => :users, :action => :change_password, :id => @user.id}, :method
> => :get %>
>
> #users controller
>
>   def change_password
>     @user = User.find(params[:id])
>     respond_to do |format|
>       format.html
>       format.js {render :layout => "modal"}
>     end
>     rescue ActiveRecord::RecordNotFound
>       permission_denied
>   end
>
> #modal layout
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
>         <title>Invoicing</title>
>
>         <link rel="stylesheet"
href="/stylesheets/styles.css" type="text/css"
> media="screen" charset="utf-8" />
>         <%= javascript_include_tag :defaults %>
>         <%= javascript_include_tag "redbox"%>
> </head>
> <body>
>
>                 <%= yield %>
>
> </body>
> </html>
>
> #change_password.js.erb
>
> <div
id="hidden_content_<%...@user.id%>_users_change_password">
> <% form_for :user, :url => changed_password_user_path(@user), :html
=>
> {:method => ''put''} do |f| %>
>         <div>Old  : <%= f.password_field :old_password, :size
=> 15 %></div>
>         <div>New  : <%= f.password_field :password, :size => 15
%></div>
>         <div>Confirm     : <%= f. password_field
:confirm_password, :size =>
> 15 %></div>
>         <p><%= f.submit "Change" %></p>
> <% end %>
> <%= link_to_close_redbox "Cancel" %>
> </div>
>
> Now when i click the link, theRedBoxOverlay is shown but the form
> does not turn up. Only the overlay is shown. If i check the dev log,
> it says the action has been successfully called and the rendering has
> been done.
> What am i doing wrong here? Any ideas?
> My best guess is that the JS is screwing up things somewhere. Or, I
> could be doing something basically very wrong.. :D
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I just had to scroll up to see the form because it was not being rendered at the center. im open to getting kicked now. free kicks for all! On Mar 19, 3:17 pm, Ram <yourstruly.vi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> link_to_redbox works though. > > #link_to_redbox link > > #in the view with the above link > > <div id="rb_test" style="display:none;"> > watsup? > <%= link_to_close_redbox "Cancel" %> > </div> > > This shows a white box in the center, slightly above center. The > spinner.gif does not get hidden even after "watsup?" is rendered. and > "watsup?" is rendered at the very bottom of the white box and a little > outside it too. > > When I use link_to_remote_redbox to render the form, in FF, I tried > selecting an arbitrary part of the result (which is just the black > transparent RB_overlay) and viewing source. > that shows the elements of the form and their full details but whats > selected is only the source for the RB_overlay div. So im guessing the > form is rendered but im not able to see it for some reason. > Another interesting thing is that when i click on "View source" for > that arbitrary selection as described above, Firebug throws an error > at the element.hide() function source code. The error message itself > is VERY long and highly truncated so im not pasting it here but will > try it if anyone thinks itll help. Firebug throws this error when i > click on "View source". > Could this element.hide() error and the spinner not hiding after > rendering "watsup?" have some connection? > > getting a bit desperate here.. all other options for a modal form seem > more complicated so I want to make sure im not making a silly mistake > before I jump into trying the other solutions. > > On Mar 18, 5:00 pm, Ram <yourstruly.vi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi all, > > > Im trying to implementredboxfor submitting some small forms. Here''s > > the code im using. > > > #redboxlink > > <%= link_to_remote_redbox ''Change Password'', :url => {:controller > > => :users, :action => :change_password, :id => @user.id}, :method > > => :get %> > > > #users controller > > > def change_password > > @user = User.find(params[:id]) > > respond_to do |format| > > format.html > > format.js {render :layout => "modal"} > > end > > rescue ActiveRecord::RecordNotFound > > permission_denied > > end > > > #modal layout > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <html xmlns="http://www.w3.org/1999/xhtml"> > > <head> > > <title>Invoicing</title> > > > <link rel="stylesheet" href="/stylesheets/styles.css" type="text/css" > > media="screen" charset="utf-8" /> > > <%= javascript_include_tag :defaults %> > > <%= javascript_include_tag "redbox"%> > > </head> > > <body> > > > <%= yield %> > > > </body> > > </html> > > > #change_password.js.erb > > > <div id="hidden_content_<%...@user.id%>_users_change_password"> > > <% form_for :user, :url => changed_password_user_path(@user), :html => > > {:method => ''put''} do |f| %> > > <div>Old : <%= f.password_field :old_password, :size => 15 %></div> > > <div>New : <%= f.password_field :password, :size => 15 %></div> > > <div>Confirm : <%= f. password_field :confirm_password, :size => > > 15 %></div> > > <p><%= f.submit "Change" %></p> > > <% end %> > > <%= link_to_close_redbox "Cancel" %> > > </div> > > > Now when i click the link, theRedBoxOverlay is shown but the form > > does not turn up. Only the overlay is shown. If i check the dev log, > > it says the action has been successfully called and the rendering has > > been done. > > What am i doing wrong here? Any ideas? > > My best guess is that the JS is screwing up things somewhere. Or, I > > could be doing something basically very wrong.. :D--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---