Print forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason

    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
  • Stuart Palmer

    #2
    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@firemai l.de> wrote in message
    news:fa6e932d.0 310280305.1a62e 95@posting.goog le.com...[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]


    Comment

    • Jason

      #3
      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@y oucant.com> wrote in message news:<bnlkom$12 e6$1@sp15at20.h ursley.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@firemai l.de> wrote in message
      > news:fa6e932d.0 310280305.1a62e 95@posting.goog le.com...[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]

      Comment

      • Vicomte De Valmont

        #4
        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=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






        "Jason" <jasonf@firemai l.de> ha scritto nel messaggio
        news:fa6e932d.0 310280305.1a62e 95@posting.goog le.com...[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]


        Comment

        • Jason

          #5
          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$hn 4$1@lacerta.tis calinet.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=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" <jasonf@firemai l.de> ha scritto nel messaggio
          > news:fa6e932d.0 310280305.1a62e 95@posting.goog le.com...[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]

          Comment

          • Vicomte De Valmont

            #6
            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=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);[/color][/color]

            "Jason" <jasonf@firemai l.de> ha scritto nel messaggio
            news:fa6e932d.0 310282308.3eec8 03d@posting.goo gle.com...[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]


            Comment

            Working...