Printing the content of a form on a new window

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"printme?openpage","newin")

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
Who is Participating?
Sjef BosmanConnect With a Mentor Groupware ConsultantCommented:
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 ;-))
varvouraAuthor Commented:
In case I didn't make myself clear

please go, 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

Sjef BosmanGroupware ConsultantCommented:
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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

varvouraAuthor Commented:
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


varvouraAuthor Commented:

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

Sjef BosmanGroupware ConsultantCommented:
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??
varvouraAuthor Commented:
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."newview?openview&restricttocategory="+Header.value,"newin")


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?

varvouraAuthor Commented:
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?
Sjef BosmanGroupware ConsultantCommented:
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.
varvouraAuthor Commented:

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.

varvouraAuthor Commented:
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
Sure, post away
Sjef BosmanGroupware ConsultantCommented:
Oh yes please... Id like a copy too.
varvouraAuthor Commented:

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="'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


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.