Opening a Popup window to print

Opening a Popup window to print

  
Hi,

I am in a search result screen, on click of a link a popup should open showing the same search results and the user can click the browser print button.

I have used a link widget and used a URL parameter as

"javascript:window.open('http://babel/ARMS_REPORT/PrintSlideCase.jsf?InFrame=true');"

in extended properties of this link, i have given target="new"

now i want to avaoid this hard coding of "http://babel/ARMS_REPORT") . can this be achieved through some APIs.

on click of this link there is an additional empty window that is being opened . I am using firefox 2.0.0.11

any solutions to this will be appreciated

Hi,

You are thinking right, and almost there :)

1 - Create a Web Screen that will handle all the logic you want to implement in the print view.

2 - From the screen you wanto to trigger the popup, create the link (using the link widget) choosing the "print screen" as the destination. Don't forget to switch the link widget method to link (instead of submit).

3 - In the extended properties of the link create:
3.1 - onclick, with something like "window.open('','printwindow','menubar=0,toolbar=0,location=0,channelmode=0,directories=0,titlebar=1,resizable=0,width=800,height=600')". Please adapt following your needs
3.2 - target, with value 'printwindow' (or the value you set in the second parameter of window.open)

That's it... This way, you will handle the link parameters totally in the service studio, and no more hard code URLs spread all over the application.

For the printing, in the screen you created for that purpose, you only have to create an expression with the value "<script language='javascript'>window.print();</script>".Don't forget to change the escape context to "no".

Please let me know the results.

Hope it helps.

Kind Regards,
Pedro
Hey Rafeeq,

Welcome to our community!
I guess this is what you want:

The extended property value is also an expression, so you can have some variables that will make your popup ULR not hard coded.
You will need some kind of configuration to store your server name. Let’s assume that a variable called ServerName will hold that value.
The eSpace name you can retrieve from a built-in Site property – TenantName.
In the end it would be something like this
"javascript:window.open('http://” + ServerName + “/” + TenantName + “/PrintSlideCase.jsf?InFrame=true');"

Glad to see you here, and hope to see you more often too.
Cheers,

André Madeira
Hello André (or Gonçalo) :),

I used to create the popups like you are suggesting, but i was faced very often with change requests and screen enrichment what usually is accomplished with more and more screen parameters.

The method I suggested handles the screen parameters with our standard link widget, what produces a 100% built to change applications.

Rafeeq, both solutions work. Try by yourself, and choose the one that fits better your needs!
Cheers,
Pedro
From the extended properties i used
onclick =

"window.open('http://"+site.ServerName+"/"+ site.TenantName + "/PrintSlideCase.jsf?InFrame=true','printwindow','menubar=0,toolbar=0,location=0,channelmode=0,
directories=0,titlebar=1,resizable=0,width=800,height=600')"

moreover for the URL parameter i gave"#"

and this works. thank you guys
-rafeeq