Solved

Printing the content of a form on a new window

Posted on 2007-11-17
14
349 Views
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

myprintwindow=window.open("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
Varvoura




Now I need to print the Address
0
Comment
Question by:varvoura
  • 8
  • 5
14 Comments
 

Author Comment

by:varvoura
Comment Utility
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

Thanks
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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
0
 

Author Comment

by:varvoura
Comment Utility
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:

a)

Print           Close

b)

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

c)
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

Thanks



0
 

Author Comment

by:varvoura
Comment Utility
sjef,

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

Thanks
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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
   http;//xxx.domain.com/database.nsf/NewView/document?OpenDocument
- 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??
0
 

Author Comment

by:varvoura
Comment Utility
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.

myprintwindow=window.open("newview?openview&restricttocategory="+Header.value,"newin")

Or

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:

ulocation:=@Middle(QUERY_STRING;"RestrictToCategory=";"&");
searchstring:=@ReplaceSubstring(ulocation;"%20";" ");
searchstring

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?

Thanks
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
Comment Utility
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 ;-))
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:varvoura
Comment Utility
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?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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.
0
 

Author Comment

by:varvoura
Comment Utility
sjef,

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.

Thanks
0
 

Author Comment

by:varvoura
Comment Utility
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
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
Sure, post away
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
Oh yes please... Id like a copy too.
0
 

Author Comment

by:varvoura
Comment Utility
OK

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..

Requirement

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
tmp:=@Middle(@UpperCase(QUERY_STRING);"RESTRICTTOCATEGORY=";"&");
tmp1:=@ReplaceSubstring(tmp;"%20";" ");
tmp1

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

Varvoura


 
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now