Connecting Tech Pros Worldwide Help | Site Map

Print forms

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 11:24 AM
Jason
Guest
 
Posts: n/a
Default 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

  #2  
Old July 20th, 2005, 11:24 AM
Stuart Palmer
Guest
 
Posts: n/a
Default 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, 11:25 AM
Jason
Guest
 
Posts: n/a
Default 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, 11:25 AM
Vicomte De Valmont
Guest
 
Posts: n/a
Default 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, 11:25 AM
Jason
Guest
 
Posts: n/a
Default 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, 11:26 AM
Vicomte De Valmont
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.