473,387 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 4701
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****@firemail.de> wrote in message
news:fa*************************@posting.google.co m...
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**********@youcant.com> wrote in message news:<bn***********@sp15at20.hursley.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****@firemail.de> wrote in message
news:fa*************************@posting.google.co m...
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=document.myform;
for(var i=0; i<theform.length; i++){
if(theform.elements[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****@firemail.de> ha scritto nel messaggio
news:fa*************************@posting.google.co m...
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.tiscalinet.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=document.myform;
for(var i=0; i<theform.length; i++){
if(theform.elements[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****@firemail.de> ha scritto nel messaggio
news:fa*************************@posting.google.co m...
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=document.myform;
for(var i=0; i<theform.length; i++){
if(theform.elements[i].type=="text"){
output+=theform.elements[i].value+"<br>";
}
}
alert(output);

"Jason" <ja****@firemail.de> ha scritto nel messaggio
news:fa**************************@posting.google.c om... 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
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,...
1
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...
3
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...
1
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...
2
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...
0
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...
3
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...
0
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...
1
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...
12
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.