Hi There,
I am trying to write a commenting system with Zend and Mootools, basically mootools provides and modalbox and Zend processes the comment etc. My issue is that I cannot get the ID of the post that the user is commenting on to move from Javscript to PHP. I think it is because the Modal window is an iFrame essentially. Below is my code,
The Javascript
<a href="#" class="5" id="ymdOpener">Open Window</a>
<script type="text/javascript">
var id = $('ymdOpener').className;
var ymd = new yamoodow([
{ url:'/comments/index/id/'+id, text:'Iframe', iframe:true } ],
{ opener:$('ymdOpener'), title: 'Yamodow-Demo' });
</script>
The Controller
public function indexAction(){
//$this->_helper->layout->disableLayout();
//$this->layout()->setLayout('commentLayout.phtml');
if(isset($_POST['submit_comment'])) {
//die("heere");
$pfx = $this->tablePrefix;
$comments = new JustMilk_Model_Comment('comments', $pfx, $this->db);
if($comments->save($this->db))
{
$this->_redirect('/comments/success');
}
}
$pms = $this->getRequest()->getParams();
$vA = array(
'id' => $pms['id'],
);
//var_dump($vA);
$this->view->assign($vA);
}
The View
<form action="" method="post">
<fieldset>
<div class="segment">
<div class="label">
<label form="email_address">Email Address</label>
</div>
<div class="input">
<input type="text" name="email_address" />
</div>
</div>
<div class="segment">
<div class="label">
<label form="show_email">Publish Email</label>
</div>
<div class="input">
<input type="checkbox" name="show_email" value="1" />
</div>
</div>
<div class="segment">
<div class="label">
<label for="comments">Comments</label>
</div>
<div class="input">
<textarea name="comments"></textarea>
</div>
</div>
<input type="hidden" name="recipe_id" value="<?=$this->id;?>" />
<div class="segment">
<div class="input">
<button class="submit" value="Submit form" type="submit" id="submit" name="submit_comment">Submit</button>
</div>
</div>
</fieldset>
Is there a reason when the ID (currently the class name of the <a>
) is not getting passsed to the controller then onto the view?