Rjs template modifying form_remote_tag

I would like to build a form which uses ajax on the first request, but
on a subsequent request uses the regular form_tag. The reason for
doing this is that I need a file upload in the second request, and so
I can’t use AJAX. I’ve tried using an rjs template to modify the
form_remote_tag’s id (using page.replace ‘form_tag_id’, …), but the
request yields a blank page.

Does anyone know how to get around this or why this is occuring?

Best Regards,

Scott T.

Hi Scott,

Scott T. wrote:

I would like to build a form which uses ajax on the first request, but on a
subsequent request uses the regular form_tag.

Sounds like you were on the right track. My recommendation would have
been
to put your initial form inside a
, create a
partial
named _new_form.rhtml with your second form wrapped in the same <div id

“unique_name”>, and in your RJS template do a page.replace ‘unique_name’
:partial => ‘new_form’

Without knowing what error’s being thrown there’s not much more we can
do to
help. A blank page means the Ajax failed. If your doing the above and
it’s
not working, your best bet is to get Firefox and Firebug fired up and
see
what’s going on. Firebug will give you the error in the console tab in
the
response to the post. What I do as I debug this stuff is copy that into
an
errorpage.html file that I keep open in my editor and in another
browser.

hth,
Bill

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs