Connecting Tech Pros Worldwide Help | Site Map

Print forms

  #1  
Old July 20th, 2005, 12:24 PM
Jason
Guest
 
Posts: n/a
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
  #2  
Old July 20th, 2005, 12:24 PM
Stuart Palmer
Guest
 
Posts: n/a

re: Print forms


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" <jasonf@firemail.de> wrote in message
news:fa6e932d.0310280305.1a62e95@posting.google.co m...[color=blue]
> 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[/color]


  #3  
Old July 20th, 2005, 12:25 PM
Jason
Guest
 
Posts: n/a

re: Print forms


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" <tryandspamme@youcant.com> wrote in message news:<bnlkom$12e6$1@sp15at20.hursley.ibm.com>...[color=blue]
> 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" <jasonf@firemail.de> wrote in message
> news:fa6e932d.0310280305.1a62e95@posting.google.co m...[color=green]
> > 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[/color][/color]
  #4  
Old July 20th, 2005, 12:25 PM
Vicomte De Valmont
Guest
 
Posts: n/a

re: Print forms


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" <jasonf@firemail.de> ha scritto nel messaggio
news:fa6e932d.0310280305.1a62e95@posting.google.co m...[color=blue]
> 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[/color]


  #5  
Old July 20th, 2005, 12:25 PM
Jason
Guest
 
Posts: n/a

re: Print forms


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
jasonf@firemail.de

Thanks,

Jason French

"Vicomte De Valmont" <NOSPAM@hotmail.com> wrote in message news:<bnn5kl$hn4$1@lacerta.tiscalinet.it>...[color=blue]
> 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" <jasonf@firemail.de> ha scritto nel messaggio
> news:fa6e932d.0310280305.1a62e95@posting.google.co m...[color=green]
> > 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[/color][/color]
  #6  
Old July 20th, 2005, 12:26 PM
Vicomte De Valmont
Guest
 
Posts: n/a

re: Print forms


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
[color=blue][color=green]
> > 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);[/color][/color]

"Jason" <jasonf@firemail.de> ha scritto nel messaggio
news:fa6e932d.0310282308.3eec803d@posting.google.c om...[color=blue]
> 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
> jasonf@firemail.de
>
> Thanks,
>
> Jason French[/color]


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Forms from Visual Studio 2005 Alex answers 2 March 13th, 2008 04:45 PM
Printing multiple forms in Access 2007 CatherineK answers 3 February 28th, 2008 11:46 PM
Printing Multiple Forms dancole42@gmail.com answers 5 March 20th, 2007 03:55 PM
Print Forms... Valx answers 1 November 15th, 2005 01:41 PM