Friday, May 1, 2009

$ajax->form in Ajax response not working

I have a .ctp file whose contents get rendered as the result of an
$ajax->form post. The response itself ALSO contains it own $ajax->form
elements. I am able to see the form come back in the response (using
firebug) - I see stuff like this:

<form id="form322281673" onsubmit="event.returnValue = false; return
false;" class="blah" method="post" action="/blah2">

as well as:

//<![CDATA[
Event.observe('form322281673', 'submit', function(event) { new
Ajax.Updater('resultDiv','/blah2', {asynchronous:true,
evalScripts:true, onComplete:function
(request, json) {}, parameters:Form.serialize
('form322281673'), requestHeaders:['X-Update', 'resultDiv']}) },
false);
//]]>

However, if I then alert() the resultDiv (or view the DOM source) I
will see that the contents of the div contain all the HTML I would
expect, but NOT the <form> or CDATA sections I mention above.

Does anyone know if these are getting stripped out when getting output
to the resultDiv, and whether there is a way to resolve this? I know
this could be something specific to do with the prototype code being
used for the Ajax calls, but it is also possible some Cake folks have
come across this before.

Thanks for your help.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: