Hello everyone, I am working with rjs templates in rails, and I’m amazed
of how simple it is to generate code with ajax, however I’am having some
troubles and I can’t seem to find a way to solve’em.
Whenever I put some code in the template, let’s say:
I get the desiered highlight allright, but, I also get the autogenerated
javascript code that makes it happen printed on screen, like so:
new Effect.Highlight("sitio37",{duration:3}); } catch (e) {
alert(‘RJS error:\n\n’ + e.toString()); (that is, it highlights the
item, but it also prits the code on the left)
This very simptom, I also get with other insertions and effects, I’m
even using a partial on the template, and it’s rendering it 3 times
(being the two firs in java code and the last in proper dhtml).
I’ve been searching for a way to avoid this undesiered output (as I’ve
desided to name it), if anyone can help it would be great.
It was a quite a silly issue tu be honest, but i’ll settle it here.
The thing is, before using rjs templates I had a normal remote_form_tag
with all of it’s ingredients:
My problem was, that when I started using rjs templates, I didn’t
realize that the update param (:update => “divid”) was generating extra
prints on the screen.
Solution:
remove the update param alltoghether, and its working like a charm.
My fault people, I didn’t see that one, sorry for taking up your time.
I put it here to help any other hwo runs into the same trouble.
The object page that is generated implicitly when we access de .rjs
template, de ActionView doc says that this page object its implicitly
wraped around an “update_page” block, it also says that update_page_tag
is exacltly like update_page only it wraps the generated code around
scrtpt tags, so I figured to change the code above code to: