Hy,
I'm using jq_link_to_remote function to load in a div a form to do answers to a comment (like in facebook). My problem is that i call this form like that 'social/respond/id/14' where id content the parent opinion. I create a funcion that setValue to a hidden field in my form.
Then, why if i try to call directly 'social/respond/id/14' it assign correctly value and when i do it with jq_link call not? I do a 'echo' of value passed as input in function than set value of field and it works fine.
Thanks.
Form code..
public function setDefaultEntityId($id_response=0)
{
if($id_response!=0){
$this->setDefault('sf_opinion_id',$id_response);
}
$this->configure();
}
template opinions
<?php echo jq_link_to_remote('opinar',
array(
'update' => 'respuesta_hidden_'.$opinion->getId(),
'url' => 'social/responder?id_response='.$opinion->getId()),array('rel' => 'nofollow','class' =>'mini')
); ?>
action responder
$this->form = new OpinionResForm();
$this->form->setDefaultEntityId($request->getParameter('id_response'));
// formulario opiniones
if($request->isMethod(sfRequest::POST))
{
$this->form->bind($request->getParameter($this->form->getName()));
if ($this->form->isValid()) {
$opinion = $this->form->save();
}
}
And finally, an example of generated code...
<a onclick="jQuery.ajax({type:'POST',dataType:'html',success:function(data, textStatus){jQuery('#respuesta_hidden_1').html(data);},url:'/sfproject/zampalo/web/frontend_dev.php/social/responder/id_response/1'}); return false;" href="#" class="mini" rel="nofollow">opinar</a>
I hope that helps... :)