How to Send Parameter to Function from Block

parameterurl

This is my try:

$this->addTab( $grup_name, array(
                'label'     => Mage::helper('netgroup_attributegrouping')->__($grup_name),
                'title'     => Mage::helper('netgroup_attributegrouping')->__($grup_name),
                'content'   => $this->getLayout()->createBlock('netgroup_attributegrouping/adminhtml_form_edit_tab_managegroup')->toHtml(), //calea catre block
                'url'=> $this->getUrl('*/*/index/' ,array('active_tab' => $grup_name))
));

is it possible that somehow to send a parameter to a a function from a block using the url attribute from tabs ? Or is the an other way ?

Best Answer

You can add a tab either by specifying the exact block

'content'   => $this->getLayout()->createBlock('netgroup_attributegrouping/adminhtml_form_edit_tab_managegroup')->toHtml(), 

In this case you can pass a parameter to the block before calling toHtml().

'content'   => $this->getLayout()->createBlock('netgroup_attributegrouping/adminhtml_form_edit_tab_managegroup')->setSomeValue($valueHere)->toHtml(),  

or if it's an ajax tab you specify the url in which case you can just pass a parameter in the url

'url'=> $this->getUrl('*/*/index/' ,array('param_name'=>$paramValue))

You cannot have a tab that is generated from both, content and url.
[EDIT]
If you are using the url approach, you can read the value sent through the url in your controller like this:

$value = $this->getRequest()->getParam('param_name'); 
//or
$value = Mage::app()->getRequest()->getParam('param_name');