A Script for entering data onto a web page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ItRover
    New Member
    • Oct 2007
    • 7

    A Script for entering data onto a web page

    Hi All,

    I need to find a way to enter data contained in a text file onto a web page, without having to type it all in, like the old windows recorder program would let you do.

    Can anyone help?
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    hi ...

    welcome to TSDN ...

    could you explain it in more detail? do you want to create webpage-content from the textfile or read it in at the clientside?

    kind regards

    Comment

    • ItRover
      New Member
      • Oct 2007
      • 7

      #3
      Originally posted by gits
      hi ...

      welcome to TSDN ...

      could you explain it in more detail? do you want to create webpage-content from the textfile or read it in at the clientside?

      kind regards
      Its a clientside process I need. I want the web page to read the data from the file into its text boxes, and the ability to push one or two buttons automatically, and when all data has been read, I need to print the web page out.

      Its the same as typing the data into a live web page using a keyboard, except that the data (and button-pushes) will all be in a file. It'll save me hours of work.

      Regards.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        hmmm ...

        that might be tricky ;) ... is it your own webpage? in case its not ... you cannot do this because we cannot cross-site-script ... we could make an attempt but therefore tell me: has the data to be submitted? through the button-clicks? ...

        kind regards

        Comment

        • ItRover
          New Member
          • Oct 2007
          • 7

          #5
          Originally posted by gits
          hmmm ...

          that might be tricky ;) ... is it your own webpage? in case its not ... you cannot do this because we cannot cross-site-script ... we could make an attempt but therefore tell me: has the data to be submitted? through the button-clicks? ...

          kind regards
          No, its not my own web page unfortunately.

          The data does have to be submitted by the button click, and the web page returned will be different each time, but the differences are known and can be anticipated.

          Regards

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            so let me summarize ... you go to a webpage ... now you have to fill in the data from a textfile ... submit the page and after it returns you want to print it out ... am i right? the page to be filled is always the same?

            Comment

            • ItRover
              New Member
              • Oct 2007
              • 7

              #7
              Originally posted by gits
              so let me summarize ... you go to a webpage ... now you have to fill in the data from a textfile ... submit the page and after it returns you want to print it out ... am i right? the page to be filled is always the same?
              Yes, thats correct. Except the page is submitted following the entry of each data item, and the printing is only done after all data has been entered.

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5390

                #8
                hmmm ...

                that's quite a task ... in case we find a a start for a solution with javascript ... would you be able to adapt it to your needs? or even to finish it? in case you are not ... i recommend you to hire a professional ... because i will not write the entire code for you :) but i would try something and would give you the idea ... ok?

                kind regards

                Comment

                • ItRover
                  New Member
                  • Oct 2007
                  • 7

                  #9
                  Originally posted by gits
                  hmmm ...

                  that's quite a task ... in case we find a a start for a solution with javascript ... would you be able to adapt it to your needs? or even to finish it? in case you are not ... i recommend you to hire a professional ... because i will not write the entire code for you :) but i would try something and would give you the idea ... ok?

                  kind regards
                  I can do simple javascript - however it was a long time ago. If you could give me the idea, it would be greatly appreciated.
                  I can take it on from there.

                  Regards and thanks for the offer.

                  Comment

                  • gits
                    Recognized Expert Moderator Expert
                    • May 2007
                    • 5390

                    #10
                    ok ... let me try something ... an i'll post an example here ... may be i will help you to go on with it ...

                    kind regards

                    Comment

                    • ItRover
                      New Member
                      • Oct 2007
                      • 7

                      #11
                      Originally posted by gits
                      ok ... let me try something ... an i'll post an example here ... may be i will help you to go on with it ...

                      kind regards

                      I'll look forward to it.

                      Regards.

                      Comment

                      • gits
                        Recognized Expert Moderator Expert
                        • May 2007
                        • 5390

                        #12
                        ok ... we cannot have a pure javascript-solution ... as i said we cannot cross-site-script for security reasons. and in case you want to have it fully automated you need your own serverside scripts! the server-script has to retrieve the page you want to fill ... you might set up a webserver on your machine ... that does that for you. now copy and send that page with some added javascript and a new input-type-file and an additional iframe to the client from your domain. now you may search the txt-file and load it to the iframe (simply set the new iframes location.href to the txt-file's source) ... now you may parse the txt file with javascript ... consider dom-methods, regEx, string-methods etc. for that ... since it is now a page of your own domain it shouldn't make problems to retrieve the textfields by its name and set the values with those from your text-file ... and when ready use a javascript form submit() to send the form.

                        hope this could be done :) ... as you can see this is not quite simple ... you should know the tradeoff ... between doing it manually or create such a little system ...

                        kind regards

                        ps: as this involves security critical issues and different technologies i don't want to post an example that i have to verify etc. ... i hope the idea could help enough ...

                        Comment

                        • ItRover
                          New Member
                          • Oct 2007
                          • 7

                          #13
                          Originally posted by gits
                          ok ... we cannot have a pure javascript-solution ... as i said we cannot cross-site-script for security reasons. and in case you want to have it fully automated you need your own serverside scripts! the server-script has to retrieve the page you want to fill ... you might set up a webserver on your machine ... that does that for you. now copy and send that page with some added javascript and a new input-type-file and an additional iframe to the client from your domain. now you may search the txt-file and load it to the iframe (simply set the new iframes location.href to the txt-file's source) ... now you may parse the txt file with javascript ... consider dom-methods, regEx, string-methods etc. for that ... since it is now a page of your own domain it shouldn't make problems to retrieve the textfields by its name and set the values with those from your text-file ... and when ready use a javascript form submit() to send the form.

                          hope this could be done :) ... as you can see this is not quite simple ... you should know the tradeoff ... between doing it manually or create such a little system ...

                          kind regards

                          ps: as this involves security critical issues and different technologies i don't want to post an example that i have to verify etc. ... i hope the idea could help enough ...
                          Interesting approach.
                          I'll have to look at it more closely tomorrow night - (up early on Mondays!)
                          I'll also look into the possibility of creating a javascript bookmarklet using C or some other language to produce the script, which can then be executed from a bookmark.

                          Meanwhile thanks for your time and efforts - they're very much appreciated.

                          I'll let you know how I get on.

                          Regards.

                          Comment

                          • gits
                            Recognized Expert Moderator Expert
                            • May 2007
                            • 5390

                            #14
                            hi ...

                            ok ... i'm looking forward to see how it is going on ...

                            the shown approach is based an the typical problem you would have with cross-site-ajax (XMLHttpRequest ) - requests. the server makes the request to a different domain for you and delivers the response from your domain now ... its a kind of proxy ... if you want to imagine it that way ...

                            kind regards

                            Comment

                            Working...