Using modal box in joomla to display a page in popup

Using a modal  to display a form/page in the popup

1) In view page

Add this in php JHTML::_(‘behavior.modal’);

A anchor tag for the link

<a rel=”{handler: ‘iframe’, size: {x: 800, y: 600}}” href=”index.php?option=com_component&task=someTask&id=someId” class=”modal” target=”_blank”>LINK</a>

To display a page in popup with out header and footers add extra parameter tmpl=component to the href

<a rel=”{handler: ‘iframe’, size: {x: 800, y: 600}}” href=”index.php?option=com_component&tmpl=component&task=sometask&id=someId” class=”modal” target=”_blank”>LINK</a>

2) In Controller  ( to close the popup and refresh the parent window )

function someFunction(){

// code to insert the data to database or some logic comes here

$doc = JFactory::getDocument();
$js = “javascript: window.parent.document.location.reload(true);”;
$js .= “javascript:window.parent.SqueezeBox.close();”;