How to make facebox popup remain open and the content inside the facebox changes after the submit
Posted
by Leonardo Dario Perna
on Stack Overflow
See other posts from Stack Overflow
or by Leonardo Dario Perna
Published on 2010-04-17T15:38:10Z
Indexed on
2010/04/17
15:43 UTC
Read the original article
Hit count: 1405
Hi, I'm a jQuery total n00b. In my rails app this what happen:
I'm on the homepage, I click this link:
<a href='/betas/new' rel='facebox'>Sign up</a>
A beautiful facebox popup shows up and render this views and the containing form:
# /app/views/invites/new
<% form_tag({ :controller => 'registration_code', :action => 'create' }, :id => 'codeForm') do %>
<%= text_field_tag :code %>
<br />
<%= submit_tag 'Confirm' %>
<% end %>
I clink on submit and if the code is valid the user is taken on another page in another controller:
def create
# some stuff
redirect_to :controller => 'users', :action => 'type'
end
Now I would like to render that page INSIDE the SAME popup contains the form, after the submit button is pressed but I have NO IDEA how to do it. I've tried FaceboxRender but this happens:
Original version:
# /controllers/users_controller
def type
end
If I change it like that nothing happens:
# /controllers/users_controller
def type
respond_to do |format|
format.html
format.js { render_to_facebox }
end
end
If I change it like that (I know is wrong but I'm a n00b so it's ok :-):
# /controllers/users_controller
def type
respond_to do |format|
format.html { render_to_facebox }
format.js
end
end
I got this rendered:
try {
jQuery.facebox("my raw HTML from users/type.html.erb substituted here")'); throw e }
Any solutions?
THANK YOU SO MUCH!!
© Stack Overflow or respective owner