I would definitely agree that you're much better off just rendering an erb
template if it's a valid submission.  Any reason your situation doesn't
allow you to do a JS append to the end of the existing comment(s)?

On Thu, Jan 14, 2010 at 10:33 PM, Peter Gumeson <[email protected]> wrote:

> Yea, good point James.  The redirect could range from ugly:
>
> render :update do |page|
>   page << "window.location = #{some_url}"
> end
>
> To really ugly (if this even works):
>
> <% form_remote_tag
>   :url => {:action => 'submit_review', :id => @product},
>   302 => "document.location = request.getResponseHeader('location')" %>
>
> Better off just doing all the logic in one action and rendering an rjs (or
> js.erb) template.
>
> Peter
>
>
> On Thu, Jan 14, 2010 at 10:15 PM, Peter Gumeson <[email protected]> wrote:
>
>> Hi Scott,
>>
>> Try removing the :update and :complete options and instead let the
>> controller and rjs/js erb templates do all the work. I have never used those
>> options before, but I believe :update makes prototype expect plain html to
>> be returned. You want to be able to conditionally redirect or render the
>> error template from your controller.
>>
>> Peter
>>
>>
>> On Thu, Jan 14, 2010 at 9:28 PM, Scott Olmsted <[email protected]>wrote:
>>
>>>
>>> Perhaps I didn't make myself clear. The form has Simple Captcha to deter
>>> spam. If the CAPTCHA is not entered correctly, then the form should be
>>> replaced by the same form with an error message and the blinking and all.
>>> That part works.
>>>
>>> If the post passes Simple Captcha's test, then it should redirect to a
>>> page showing all posts in the thread, including the one just entered. This
>>> is the part that doesn't work, the browser doesn't respond to the new page,
>>> delivered in its entirety if I interpret the log correctly.
>>>
>>> Scott
>>>
>>>
>>> At 08:42 PM 1/14/2010, you wrote:
>>>
>>> If you're redirecting to another page, why is there are need to make it
>>> an AJAX request?  Just make it a standard POST and handle the redirect in
>>> the controller.
>>>
>>> James
>>>
>>> On Thu, Jan 14, 2010 at 8:39 PM, Scott Olmsted <[email protected]>
>>> wrote:
>>>
>>>  A client has a site with a page that uses form_remote_tag to replace a
>>> form with either a "Thanks for your submission" message or the form with an
>>> error message and a blinking effect:
>>>
>>>  <% form_remote_tag
>>>   :url => {:action => 'submit_review', :id => @product},
>>>   :update => 'review_form',
>>>   :complete => visual_effect(:pulsate, "review_form", :pulses => 5,
>>> :duration => 2.5) do -%>
>>>
>>> I would like to do the same for a form on a different page, but on
>>> success instead of replacing the form with a message, I just want to
>>> redirect to another page entirely.
>>>
>>> I have not figured out how to do this. I can change the controller code
>>> and Rails says it did the redirect, but the browser doesn't see it. Is this
>>> even possible?
>>>
>>> Thanks,
>>>
>>> Scott
>>>
>>> --
>>> SD Ruby mailing list
>>> [email protected]
>>>  http://groups.google.com/group/sdruby
>>>
>>>
>>> --
>>> SD Ruby mailing list
>>> [email protected]
>>>  http://groups.google.com/group/sdruby
>>>
>>> --
>>> SD Ruby mailing list
>>> [email protected]
>>> http://groups.google.com/group/sdruby
>>>
>>
>>
>>
>> --
>> Peter Gumeson
>> [email protected]
>>
>>
>
>
> --
> Peter Gumeson
> [email protected]
>
>
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
>
-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to