Link to home
Start Free TrialLog in
Avatar of Rakttt
Rakttt

asked on

open a action in Pop up window

I have a link that works fyn but i want it to open up in a pop up window rather than in new tab.

 echo $this->Html->link($book['Book']['serial_num'], array('controller' => 'books', 'action' => 'view', $book['Book']['id']), array('title' => 'View Book details of '.$book['Book']['serial_num']));

Any help. Thanks In Advance.
Avatar of Gary
Gary
Flag of Ireland image

Try
echo $this->Html->link($book['Book']['serial_num'], array('controller' => 'books', 'action' => 'view', $book['Book']['id']), array('title' => 'View Book details of '.$book['Book']['serial_num'],'target'=>'_blank'));

Open in new window

Avatar of Rakttt
Rakttt

ASKER

@GaryC123: Thanks for the help.
But it doesn't solve my problem. It open up in new tab as before, I want action to open in a new pop up window.
Sorry misread the question.
echo $this->Html->link($book['Book']['serial_num'],
array('controller' => 'books', 'action' => 'view',
		$book['Book']['id']),
		array(
		'title' => 'View Book details of '.$book['Book']['serial_num'],
		'onclick' => "var openWin = window.open('".$this->Html->link($book['Book']['serial_num'].'"','_blank')
	)
))
);

Open in new window


Just double check my syntax, and you haven't mentioned if you need additional attributes set.
Avatar of Rakttt

ASKER

@GaryC123: It still doesn't open up a pop up. It opens the action in same window and same tab.
Earlier it opens up in same window but new tab.
Getting late...try this
echo $this->Html->link($book['Book']['serial_num'],
array('controller' => 'books', 'action' => 'view',
		$book['Book']['id']),
		array(
		'title' => 'View Book details of '.$book['Book']['serial_num'],
		'onclick' => "var openWin = window.open('".$this->Html->link($book['Book']['serial_num']."','_blank');return false;"
);

Open in new window

If it doesn't work can you post the rendered HTML.

Note: you cannot force a popup if it is set to open in a new tab by user preferences.
Avatar of Rakttt

ASKER

@Garyc123: it gives me syntax error.
echo $this->Html->link($book['Book']['serial_num'],
array('controller' => 'books', 'action' => 'view',
		$book['Book']['id']),
		array(
		'title' => 'View Book details of '.$book['Book']['serial_num'],
		'onclick' => "var openWin = window.open(this.href,'_blank');return false;")
);

Open in new window


I have to go now, if it's still not working just check the syntax
Avatar of Rakttt

ASKER

@GaryC: This thing doesn't open a pop up window yet.
Can you paste the actual html from the webpage source
ASKER CERTIFIED SOLUTION
Avatar of Rakttt
Rakttt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rakttt

ASKER

It was as easy as 1 2 3.. n done