How to Iterate reading numerous file-field forms ???

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

    How to Iterate reading numerous file-field forms ???

    I have more than one File field forms named filename0, filename1,
    filename2, and so on.....

    And then I use javascript to read the value:

    document.formup load.filename0. value
    document.formup load.filename1. value

    But I want to iterate it in a FOR loop, to save long codes.

    for (i = 0; i < 9; i++) {
    document.formup load.filename(? ??).value
    }

    How do I use JS to solve the above problem, to replace the (???), to
    read the values of all the forms.

    This surely have been answered before, but I don't know what keywords
    to google for.

    So anyone can help will be appreciated. TIA

    roger
  • G Roydor

    #2
    Re: How to Iterate reading numerous file-field forms ???

    essayez :

    for (i=....) {
    var xx=document.for mupload.filenam e + i;

    alert (xx.value);
    }
    HelLind a écrit:[color=blue]
    > I have more than one File field forms named filename0, filename1,
    > filename2, and so on.....
    >
    > And then I use javascript to read the value:
    >
    > document.formup load.filename0. value
    > document.formup load.filename1. value
    >
    > But I want to iterate it in a FOR loop, to save long codes.
    >
    > for (i = 0; i < 9; i++) {
    > document.formup load.filename(? ??).value
    > }
    >
    > How do I use JS to solve the above problem, to replace the (???), to
    > read the values of all the forms.
    >
    > This surely have been answered before, but I don't know what keywords
    > to google for.
    >
    > So anyone can help will be appreciated. TIA
    >
    > roger[/color]

    Comment

    • Steve van Dongen

      #3
      Re: How to Iterate reading numerous file-field forms ???

      G Roydor <guy.roydor@NOl aposteSPAM.net> wrote:
      [color=blue]
      >HelLind a écrit:[color=green]
      >> I have more than one File field forms named filename0, filename1,
      >> filename2, and so on.....
      >>
      >> And then I use javascript to read the value:
      >>
      >> document.formup load.filename0. value
      >> document.formup load.filename1. value
      >>
      >> But I want to iterate it in a FOR loop, to save long codes.
      >>
      >> for (i = 0; i < 9; i++) {
      >> document.formup load.filename(? ??).value
      >> }
      >>
      >> How do I use JS to solve the above problem, to replace the (???), to
      >> read the values of all the forms.
      >>
      >> This surely have been answered before, but I don't know what keywords
      >> to google for.[/color][/color]
      [color=blue]
      >essayez :
      >
      >for (i=....) {
      >var xx=document.for mupload.filenam e + i;
      >
      >alert (xx.value);
      >}[/color]

      a.b is equivalent to a["b"]

      document.formup load["filename" + i]

      Regards,
      Steve

      Comment

      • Mick White

        #4
        Re: How to Iterate reading numerous file-field forms ???

        HelLind wrote:
        [color=blue]
        > I have more than one File field forms named filename0, filename1,
        > filename2, and so on.....
        >
        > And then I use javascript to read the value:
        >
        > document.formup load.filename0. value
        > document.formup load.filename1. value
        >
        > But I want to iterate it in a FOR loop, to save long codes.
        >
        > for (i = 0; i < 9; i++) {
        > document.formup load.filename(? ??).value
        > }
        >[/color]
        var f=9
        while(f--){document.form upload["filename+i].value}
        Mick


        [color=blue]
        > How do I use JS to solve the above problem, to replace the (???), to
        > read the values of all the forms.
        >
        > This surely have been answered before, but I don't know what keywords
        > to google for.
        >
        > So anyone can help will be appreciated. TIA
        >
        > roger[/color]

        Comment

        • HelLind

          #5
          Re: How to Iterate reading numerous file-field forms ???

          it works, thanks all.

          Comment

          Working...