473,804 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Print forms

Hello,

I am working on a website which uses forms to fill in a few answers to
questions. Does anybody know a javascript that prints only the answers
(i.e. the forms) and not the whole page?

I am asking this because printing the whole page takes 3 pieces of
paper, whilst printing only the answers will only take one.

Thank you.

Jason
Jul 20 '05 #1
5 4718
I have seen instances where onsubmit the form, it opens a small popup window
i a location off the visual screen size and this popup has a page in it with
the answers, this runs window.print onload, then after that runs
window.close. Thus prinitng the page and then closing it.

Would that do/sould like what you want to do?

Stu

"Jason" <ja****@firemai l.de> wrote in message
news:fa******** *************** **@posting.goog le.com...
Hello,

I am working on a website which uses forms to fill in a few answers to
questions. Does anybody know a javascript that prints only the answers
(i.e. the forms) and not the whole page?

I am asking this because printing the whole page takes 3 pieces of
paper, whilst printing only the answers will only take one.

Thank you.

Jason

Jul 20 '05 #2
That would be great! Can you help me with this script? I am quite a
novice into javascript coding, so I could use a little help.

Thanks,

Jason

"Stuart Palmer" <tr**********@y oucant.com> wrote in message news:<bn******* ****@sp15at20.h ursley.ibm.com> ...
I have seen instances where onsubmit the form, it opens a small popup window
i a location off the visual screen size and this popup has a page in it with
the answers, this runs window.print onload, then after that runs
window.close. Thus prinitng the page and then closing it.

Would that do/sould like what you want to do?

Stu

"Jason" <ja****@firemai l.de> wrote in message
news:fa******** *************** **@posting.goog le.com...
Hello,

I am working on a website which uses forms to fill in a few answers to
questions. Does anybody know a javascript that prints only the answers
(i.e. the forms) and not the whole page?

I am asking this because printing the whole page takes 3 pieces of
paper, whilst printing only the answers will only take one.

Thank you.

Jason

Jul 20 '05 #3
ciao
well it can be achieved in a variety of ways. I don't know precisely how
your page is arranged, and thus I can make only a few suggestions, not
necessarily the best ones, yet functional and they could be more precise
knowing better your pages.
Your 'problem' is basically to isolate a few form fields. let's say they are
input type="text" fields. Say your form has a name: "myform". This goes (or
must be called) after the form has loaded (arguably, you'll nest it within a
function, returning the output)

var output="";
var theform=documen t.myform;
for(var i=0; i<theform.lengt h; i++){
if(theform.elem ents[i].type=="text"){
output+=theform .elements[i].value+"<br>";
}
}
alert(output);/*in a function: return output; to write document wriote or
whatever depending on where you print, maybe a textarea I have no clue*/

I hope this is what you meant. if you know beforehand the names of the form
fields involved, or they are arranged so that only a suffix chages, we can
even arrange faster loops, if that is of any concern for you.
ciao
Alberto Vallini
http://www.unitedscripters.com/

"Jason" <ja****@firemai l.de> ha scritto nel messaggio
news:fa******** *************** **@posting.goog le.com...
Hello,

I am working on a website which uses forms to fill in a few answers to
questions. Does anybody know a javascript that prints only the answers
(i.e. the forms) and not the whole page?

I am asking this because printing the whole page takes 3 pieces of
paper, whilst printing only the answers will only take one.

Thank you.

Jason

Jul 20 '05 #4
Hi Alberto,

Thank you for your reply.

Since I am not very much known with javascript coding/syntax, would it
be an idea if I send you a copy of the webpage, so you can have a
closer look to it? If you agree, please send your email address to
ja****@firemail .de

Thanks,

Jason French

"Vicomte De Valmont" <NO****@hotmail .com> wrote in message news:<bn******* ***@lacerta.tis calinet.it>...
ciao
well it can be achieved in a variety of ways. I don't know precisely how
your page is arranged, and thus I can make only a few suggestions, not
necessarily the best ones, yet functional and they could be more precise
knowing better your pages.
Your 'problem' is basically to isolate a few form fields. let's say they are
input type="text" fields. Say your form has a name: "myform". This goes (or
must be called) after the form has loaded (arguably, you'll nest it within a
function, returning the output)

var output="";
var theform=documen t.myform;
for(var i=0; i<theform.lengt h; i++){
if(theform.elem ents[i].type=="text"){
output+=theform .elements[i].value+"<br>";
}
}
alert(output);/*in a function: return output; to write document wriote or
whatever depending on where you print, maybe a textarea I have no clue*/

I hope this is what you meant. if you know beforehand the names of the form
fields involved, or they are arranged so that only a suffix chages, we can
even arrange faster loops, if that is of any concern for you.
ciao
Alberto Vallini
http://www.unitedscripters.com/

"Jason" <ja****@firemai l.de> ha scritto nel messaggio
news:fa******** *************** **@posting.goog le.com...
Hello,

I am working on a website which uses forms to fill in a few answers to
questions. Does anybody know a javascript that prints only the answers
(i.e. the forms) and not the whole page?

I am asking this because printing the whole page takes 3 pieces of
paper, whilst printing only the answers will only take one.

Thank you.

Jason

Jul 20 '05 #5
ciao jason,

well post it here, if it is not too long. yet you can reiterate all the
elements in a form in the way I previously stated so if you do that, you'll
achieve your result. It's simpler that you may think. if you're new at js as
you say the best way to learn is to just try coding - never mind of mistkes,
everybody makes it and you can find everyday expert programmers that are
liable to the silliest mistakes like forgetting a dot, an escape char, or a
comma. That's just normal, human. Don't worry. if they say to you they have
achieved a point where they don't make silly mistakes anymore any longer
don't believe it :-) We all make mistakes, and it is exactly by making
mistakes that you can get proficiency.
try that code. make a snippet form with 2 or 3 fields and then run it (of
course be sure the name of the form matches)
ciao
Alberto
var output="";
var theform=documen t.myform;
for(var i=0; i<theform.lengt h; i++){
if(theform.elem ents[i].type=="text"){
output+=theform .elements[i].value+"<br>";
}
}
alert(output);

"Jason" <ja****@firemai l.de> ha scritto nel messaggio
news:fa******** *************** ***@posting.goo gle.com... Hi Alberto,

Thank you for your reply.

Since I am not very much known with javascript coding/syntax, would it
be an idea if I send you a copy of the webpage, so you can have a
closer look to it? If you agree, please send your email address to
ja****@firemail .de

Thanks,

Jason French

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1530
by: hesing Qiang | last post by:
In Print Process,I use the code,but it is not run correctly On WINDOWS 98 . I didn't know why ...? this.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); ..... graphics.DrawString(strtmp,this.Font,this.brushBlack, DrawStringValidRect(ref ,graphics,this.Font ,
1
2130
by: DD | last post by:
I have a mainform with a subform. The main form as a dropdown box "chooseDate", in the afterupdate event i requery the subform so all records with the same date are viewed. Now i only want to print the selected records of the selected month Can any one advise on the code to add to the print button i have tried this StrLinkCriteria = ".forms! = " & Me! this does not work
3
11872
by: sea | last post by:
I need to be able to print the current form because the form has an embedded object of a .gif file, so report will not work -- does anyone know the way to do this? I tried some code, not sure what it was now, guess docmd.printout or something but that prints ALL the forms -- also the each page of the form does not always start at the next page even if allowcontinuousforms is set to no. The preview button previews all the forms as well,...
1
3149
by: Randy | last post by:
I have tried the code to attach a button to a form and use the help information on coding, but I can't seem to get it to work. I have a main form called MAIN CLIENT INFO2 There is a subform called Client Contacts. I want to print the current record using the ID field in the Client Contacts subform in a report. I want to print to a report called MAIN CLIENT INFO using the current record in the subform.
2
1752
by: David Sabo | last post by:
Hi all... I having trouble printing on Win98. I cannot print more than once if I'm lucky in win98, when the printdocument.print() is executed the following Exception is raised. It doesn't start to execute the method raised by the event PrintPage. ************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object.
0
2984
by: lumazi | last post by:
Hello all, I'm having an issue printing to a network printer. The line of code is fairly simple printDocument1.Print(); When you select print from a local printer it works fine, when you select a network printer you get the following error.
3
4357
by: Garmt de Vries | last post by:
On the website of the Dutch Jules Verne Society (www.jules-verne.nl), we have several forms that visitors can use to order something, or to apply for membership. Of course, a form's primary purpose is to be filled out online, but I can imagine, for example, one of our members giving a talk and printing a pile of application forms to hand out to the audience. I am trying to add some specific styles in the print stylesheet so the forms...
0
1642
by: ShaneO | last post by:
There have been similar questions raised in the past, however no answers seem to have been provided, so I thought I'd give it a go. Scenario 1: My Windows Forms app generates (say) 10 pages in a Print Preview Control. These pages are made up of varying sized graphics and text, therefore each page is unique but does rely on the content of the previous page to determine the final page layout. My User wants to print ALL pages, pages 1 &...
1
11506
by: kirkus84 | last post by:
I am currently trying to do a multiple record mail merge through a query via a command button on a form. The query basically displays customers who have said yes to privacy. The user inputs a date into txtDate on frmDate and the clicks "View Queried Privacy Records" Once they click this it opens the query form frmPrivacy which then has a command button cmdMailmerge to perform the mail merge and print the records that result from that query. (I...
12
3545
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to print the report three times, but do not know how
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.