I've come a little further with my issue. I can now make an AJAX call with
JQuery, but it will not return the subform. When I echo a line in my action,
that is returned, but now I get an "invalid controller specified" in the
return of the AJAX call. Here's my changed code:
Moved the init() code to the imageformAction:
public function imageformAction()
{
if ($this->getRequest()->isXmlHttpRequest())
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('imageform',
'html')->initContext();
$id = $this->_getParam('id', null);
$this->getForm()->addSubForm(new RS_Form_Pimage(), 'pImage'.$id);
}
}
JQuery javascript:
function ajaxAddField()
{
$.post("/admin/project/imageform",{"pid": id},
function(response)
{
var subForm = $(response);
$("#addBtn-label").prepend(subForm);
});
}
I hope someone can help me out here, so I can get the subforms dynamically
into my form.
Many thanks in advance.
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/add-subform-using-Jquery-and-AJAX-tp2075629p2125198.html
Sent from the Zend Framework mailing list archive at Nabble.com.