Magento - Communication between 2 blocks
I made a module with 2 blocks: - a block in the right column contains a form, - And a block in the middle of the page
I would like the block of the middle of the page receives the variables sent by the form of block on the r开发者_如何学Pythonight.
I am a bit lost ...
Thanks
Submitting a form requires the page to re-post, so you should be able to get the parameters from the posted array directly. If you don't want to redraw the entire page, you'll want to use Javascript to read the input fields and change the second block directly.
More detail on what the two blocks are supposed to do would be helpful. Also, you're likely to get more responses if you accept answers to questions that you post. You have 8 questions and no accepted answers right now, which will discourage people from answering.
Thanks, Joe
It's still not clear whether you want to update w/ Javascript or after posting the page.
If Javascript, do something like this:
var boxval = $("#elem1_id").val();
$("#elem2").append(boxval);
If posting, set some name for the input and do this in box two's class:
public function __construct() {
parent::__construct();
$this->setPostedValue($this->getRequest()->getParam('box1name'));
}
And in your template:
<?php print $this->getPostedValue(); ?>
精彩评论