Populate HTML Form from Text file...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jcnone@none.com

    Populate HTML Form from Text file...

    Does anyone know how to populate form fields on a html web page (client
    side) with data from an Excel file (CSV) or text file. I am currently having to
    input data to many text fields manually. I would like to transfer the data into the
    web form programatically from a CSV/text file. How can this be done? I am
    new to javascript, but I will work through the challange if possible. Please help!
    Thanks.
    Jman



    --
    --------------------------------- --- -- -
    Posted with NewsLeecher v3.7 Final
    Web @ http://www.newsleecher.com/?usenet
    ------------------- ----- ---- -- -

  • Evertjan.

    #2
    Re: Populate HTML Form from Text file...

    jcnone@none.com wrote on 28 jun 2008 in comp.lang.javas cript:
    Does anyone know how to populate form fields on a html web page
    (client side) with data from an Excel file (CSV) or text file. I am
    currently having to input data to many text fields manually. I would
    like to transfer the data into the web form programatically from a
    CSV/text file. How can this be done? I am new to javascript, but I
    will work through the challange if possible. Please help!
    If this is an "only once" task, just convert the textfile by text editor to
    a javascript array, that you then make part of the javascript of your html
    page, [or call as an local external .js file, if your html is also local].

    "field1","field 2","field3","fi eld4"
    "2field1","2fie ld2","2field3", "2field4"

    becomes:

    var myArray = [
    ["field1","field 2","field3","fi eld4"],
    ["2field1","2fie ld2","2field3", "2field4"]
    ];

    field 2 of the second row is accessed as:

    var result = myArray[1][1];

    =========

    If this is a more habitual task, doing this serverside
    by serverside coding, would be easier,
    as access to text, etc. files
    by code is no problem on the server.

    Accessing a file on the client from and with browser javascript
    would be seen as a security violation under normal browser settings.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • jcnone@none.com

      #3
      Re: Populate HTML Form from Text file...

      Evertjan,
      Thanks for your reply.
      This process will need to be done on a regular basis and I will not
      have access to the server. It must all be done client-side. I am
      provided a form online which has many input fields including text
      fields, radio buttons and checkboxes. My imput data is in a text/CSV
      file and is manually imput into the form. I want to use javascript
      to cycle through the text file and input the data into the form. The
      form includes text fields, radio buttons and checkboxes.
      Any help, code, links etc. is greatly appreciated. Thanks.
      Jman


      --
      --------------------------------- --- -- -
      Posted with NewsLeecher v3.7 Final
      Web @ http://www.newsleecher.com/?usenet
      ------------------- ----- ---- -- -

      Comment

      • Evertjan.

        #4
        Re: Populate HTML Form from Text file...

        jcnone@none.com wrote on 28 jun 2008 in comp.lang.javas cript:

        [please always quote on usenet, this is not email]
        This process will need to be done on a regular basis and I will not
        have access to the server. It must all be done client-side. I am
        provided a form online which has many input fields including text
        fields, radio buttons and checkboxes. My imput data is in a text/CSV
        file and is manually imput into the form. I want to use javascript
        to cycle through the text file and input the data into the form. The
        form includes text fields, radio buttons and checkboxes.
        Why javascript?

        And where do you put your javascript
        if the page with the form is not yours?

        And where is your text file located?

        Is it only your personal browser on your own PC?

        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress)

        Comment

        • MikeB

          #5
          Re: Populate HTML Form from Text file...


          "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
          news:Xns9ACB86B 64C103eejj99@19 4.109.133.242.. .
          jcnone@none.com wrote on 28 jun 2008 in comp.lang.javas cript:
          >
          [please always quote on usenet, this is not email]
          >
          >This process will need to be done on a regular basis and I will not
          >have access to the server. It must all be done client-side. I am
          >provided a form online which has many input fields including text
          >fields, radio buttons and checkboxes. My imput data is in a text/CSV
          >file and is manually imput into the form. I want to use javascript
          >to cycle through the text file and input the data into the form. The
          >form includes text fields, radio buttons and checkboxes.
          >
          Why javascript?
          >
          And where do you put your javascript
          if the page with the form is not yours?
          >
          And where is your text file located?
          >
          Is it only your personal browser on your own PC?
          I have done this by using frames in an HTA.
          Put the "Remote" document in Frame2 with the JScript code in Frame1.

          The stuff I have is about 5 years old, but still works.

          You have to look at the source of the remote page to get the Fields ID or NAME,
          then in the create the TextFile data in Name/Values pairs.

          The JScript code hasn't been updated nor do I use JScript very often.

          The Zip is at http://www.byerley.net/AutoFill.zip

          There is a ReadMe in the Zipper.

          Don't be a critic of the JScript or anything else, it was an exercise as proof
          of concept at the time.
          --
          Evertjan.
          The Netherlands.
          (Please change the x'es to dots in my emailaddress)

          Comment

          • Jorge

            #6
            Re: Populate HTML Form from Text file...

            On Jun 28, 1:33 pm, "MikeB" <m.byerleyATVer izonDottieNetti ewrote:
            >
            You have to look at the source of the remote page to get the Fields ID orNAME,
            then in the create the TextFile data in  Name/Values pairs.
            >
            The JavaScript code can be can be injected into the page via a
            bookmarklet :



            (Tested in Safari, Opera, FF2, FF3)

            --Jorge.

            Comment

            • jcnone@none.com

              #7
              Re: Populate HTML Form from Text file...

              "In resonse to Evertjan:
              - What language will accomplish this? javaScript or whatever
              language will work is fine.
              - Precisely, where do I put the javascript or whatever language to
              make it affect a seperate page? I am tryin to figure this out.
              - The text file data to fill the form is on my computer.
              - The browser is on my personal computer.

              Thanks for your help



              --
              --------------------------------- --- -- -
              Posted with NewsLeecher v3.7 Final
              Web @ http://www.newsleecher.com/?usenet
              ------------------- ----- ---- -- -

              Comment

              • Evertjan.

                #8
                Re: Populate HTML Form from Text file...

                jcnone@none.com wrote on 28 jun 2008 in comp.lang.javas cript:
                "In resonse to Evertjan:
                - What language will accomplish this? javaScript or whatever
                language will work is fine.
                Ah, but only javascript is on topic here.
                - Precisely, where do I put the javascript or whatever language to
                make it affect a seperate page? I am tryin to figure this out.
                Well, if you do not have the js interpreted by your browser js-engine,
                but say use it in cscript, then there is a whole different situation.
                - The text file data to fill the form is on my computer.
                - The browser is on my personal computer.
                Then you will need the access that txt file from your browser.

                The .hta way, as suggested by mikeB, is a good choice,
                but fails is the external form file needs cookies, I think.

                Using a favelet and changing the text file
                to an array containing .js file,
                seems another good option.

                Now it seems time for you to start experimenting, Jman.

                --
                Evertjan.
                The Netherlands.
                (Please change the x'es to dots in my emailaddress)

                Comment

                Working...