Printing the content of a form on a new window

Posted on 2007-11-17
Medium Priority
Last Modified: 2013-12-18
Hi all,

This is a Domino Web Application

I have a $$viewtemplate for viewname form which displays a Map and a postal address for a location selected by a user in a field called "location field". On that same form I have a lot of other information which I don't want to print. However, I do want to print the Map & Address of the selected value in a window window(preferrably a new page) which I will apply css to so it is more presentable when printed.

So what I have

1. on the current $$viewtemplate for viewname form, a "Print" button that calls a page called "printme"
with the following onclick event


2. that opens up the new page which I set up for printing and which also have another print button with the onclick value of "window.print()"

3. Problem, I want to get the exact address & map of $$viewtemplate for viewname to open in this new window so I can print them.

How do I achieve this?

Note that, I don't want to just open & print the entire current content of $$viewtemplate for viewname in a new window because I want to use the new page that I am setting up to format the output nicely for printing

Thank you in advance

Now I need to print the Address
Question by:varvoura
  • 8
  • 5

Author Comment

ID: 20303931
In case I didn't make myself clear

please go www.googlemaps.com, select and address - then go to "print", you can see how the map opens up in a new window formatted nicely with an additional notes field at the top right hand corner

LVL 46

Expert Comment

by:Sjef Bosman
ID: 20306942
Don't really understand. If it's about printing and hiding stuff from being printed, you can use CSS to do that. If it's the URL you need to open the same document in your print window, why do you open a PAGE in there? A Page will never be a form or a document, so what is it exactly you want to be printed? I also don't understand the viewtemplate thing, it serves to display a view but you didn't mention a view...

Confused... :-S

Author Comment

ID: 20307018
OK, let's see if I can make you understand this

1. I have a view which has a list of our location(business locations)
2. There is a second form in another frame, in which users select the location.
3. When the location is selected, its value is populated in a computedtext value on a $$viewtemplate for viewname
4. On that same form, we have an embedded view formatted to display the address of the selected location
5. Also, the following formula is found on the $$viewtemplate for viewname, this is to calculate the address & display it on the map.

 <script>var getaddress = "computedtext"</script>
<div id="map" style="width: 500px; height: 300px";></div>

6. getaddress is called on the onload event of the $$viewtemplate for viewname form

What I need.

1. To have a button in the current $$viewtemplate for viewname form which will initiate a new window that has the following:


Print           Close


Address as is in the window of $$viewtemplate for viewname

value of getaddress above as is in the first window $$viewtemplate for viewname

This  way the user can click the print on the second window to get a printout of the location displayed nicely(probably by using css to add some style the new page

Is this better?

If you still confused, I can send you  a minimized copy of db


What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 20307028

I need to open the current document in a new window, this window can be a new form formatted the way I will set up in the CSS, however, the address information(Query_String) picked up from this form $$viewtemplate for viewname should be transferred to the new window.

I am sorry if I haven't been very clear here, but I am a bit stressed since the issue is related to a project that's already in production

If any addtional information are required, please ask

LVL 46

Expert Comment

by:Sjef Bosman
ID: 20307230
Okay, I still have to re-read your two posts above, but I think I get the general idea. You want to open a new window for a document, with a special layout, but you don't know how to. Assuming that is the case, here are some general guidelines:
- To open a document with a specific layout, other than using the standard form, you can create a new view (e.g. NewView), create a Form Formula in the view which specifies the form that is to be used to show the document, and use that in a URL. The Form Formula overrides the Form field that's in the document. The URL would be something like
- If you need to add specific parameters to the URL, you can of course, I assume you know how to do that
- You can even create the URL using JavaScript, or modify it. You could take the URL to the current page (location.href) and modify it to your needs. You can also append the parameter and content to the URL, so you can get it back in the form using Query_String.
- The special form, as named in the view's Form Formula, can contain the makeup you want the document to have (including CSS etc.)

Am I close??

Author Comment

ID: 20307367
Yes very close.

Using your theory then, would it be safe to do the following:
1. On the current $$viewtemplate for view1 form have the following "Print" button
2. The print button on that form will have the following formula.



location.href ='/path/db.nsf/newview?OpenView&restricttocategory=' + Header.value;}

Where Header is a computer for display field on the original $$viewtemplate for view1 form and has the following value:

searchstring:=@ReplaceSubstring(ulocation;"%20";" ");

That's suppose to return the location in that view and display it in $$viewtemplate for view1 and now when called as above  in the $$viewtemplate for view2 which is the duplicate of view1 & form1 with the amended style to it

3. Obviously I would create a second view called view2 and a $$viewtemplate for view2 form which  I'll have view 2 embedded on and the map as $$viewtemplate for view1 and the few other css mod

Will that do the trick?
I won't be able to test because I don't have a server at home. So can you please review and tell me whether or not this will work.

If not, are you able to suggest different alternatives?

LVL 46

Accepted Solution

Sjef Bosman earned 2000 total points
ID: 20307422
You want a VIEW in your new window, or a DOCUMENT?

Just had lunch, so I still have to read your two (eh... three) earlier posts ;-))

Author Comment

ID: 20308769
I want the one ONLY ONE document that is opened for printing in the first window

So when the user selects a location from a dialog box, the location address is display and populated on the Map on that $$viewtemplate for view1 form. My print button on that form should open that SAME document that opened in the first $$viewtemplate for view1 when the user selected the location from the dialog list location field should then open in a new window(form) which has the applied css to it

Is this better?
LVL 46

Expert Comment

by:Sjef Bosman
ID: 20309041
Eh.... nope :-)  Somehow, in your story, the notions of forms, documents and views get mixed up. You say you want to open a DOCUMENT and that you show it in the viewtemplate form, but that doesn't quite add up. If you want a document to use the viewtemplate form to be displayed, or a similar form, then make a copy of that form and save it under a different name. If both forms share a lot of fields and other stuff, then use a subform for the common things.

Although I don't have access to the Internet yet from here (I'm not at home), I hope to get it soon. Feel free to send me a reduced but working (!) database. I can't promise to have a look at it tomorrow (which must be today for you) but I'll do my best.

Author Comment

ID: 20311546

I think that I have this resolved now. One small issue with it though, it seems to display wrong region on the second Map(second window) only for some of the locations.

Do you still want me to send you the db to take a look at. I think that you'll be able to diagnose the cause of this error much faster than me.


Author Comment

ID: 20318227
The issue has been resolved

If any one cares to know about the resolution, let me know I can post it. It is a bit conplicated and different.  

Many thanks everyone
LVL 31

Expert Comment

ID: 20323460
Sure, post away
LVL 46

Expert Comment

by:Sjef Bosman
ID: 20337879
Oh yes please... Id like a copy too.

Author Comment

ID: 20357005

My request was:

1. I have a "Location" View embedded on a form called $$viewtemplate for Location.
2. On that same form, there's a drop down select field for the location, where the user can select the location that they'll be searching for
3. Another thing found on that form. A JS call to load the google Maps based on the value of location selected by the user
4. The form also has Query_String field to pick up the value selected by the user, etc..


1. When the user selects the location in the current $$viewtemplate location form, he needs to be able to print the results in a new window, which is formatted slightly different from the current window(more like a printer friendly type output)

To go around this problem

1. I created a duplicate copy of the locations view, called it location1
2. I create a new $$viewtemplate for location1 form to which I applied the style that I wanted as a printing output

Then back on $$viewtemplate for location form,

1. I created a field & called it "trimloc" with the following formula
tmp1:=@ReplaceSubstring(tmp;"%20";" ");

2. The result of 1 gave me the exact location name the user selected trimmed from spaces, etcc
3. I then used that "trimdoc" behind the print button as follows:
    <input type="button" value="Print" onclick="window.open('location1?     openview&restricttocategory='<ComputedValue>, 'newin');">

Where the "ComputedValue" = tmp1 above

4. This opened the new window $$viewtemplate for location1 which was called when the print button was clicked and restricted the display on that second form to the category displayed in the "ComputedValue" text

5. The style (display) that i wanted the user to have as a end result of printing was applied in the
HTML header content of $$viewtemplate for location1

6. The $$viewtemplate for location1 form also had a "Print" button to enable the user to print that screen(Map & address displayed nicely) & an Exit button to exit that screen & return to previous window

I Hope my solution helps someone in need & Thank you all again for your prompt responses and help



Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month16 days, 20 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question