File Open Dialog Box

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

    File Open Dialog Box

    Hello there,

    I would like to open a "Chose File " dialog box using javascript.

    I am using C# as the server side programming language.

    I have tried <Input type="file" tag, and then "showModalDialo g".

    any help please.

    Kind Regards,
    Pai
  • Lasse Reichstein Nielsen

    #2
    Re: File Open Dialog Box

    spai@immunetole rance.org (Pai) writes:
    [color=blue]
    > I would like to open a "Chose File " dialog box using javascript.[/color]
    [color=blue]
    > I am using C# as the server side programming language.
    > I have tried <Input type="file" tag, and then "showModalDialo g".[/color]

    That would be serverside, and will ofcourse not work on the client.
    [color=blue]
    > any help please.[/color]

    If you have
    <form id="foo">
    <input type="file" name="bar">
    </foo>
    then in IE, you can activeate the file input by simulating
    a click on the input: document.forms['foo'].elements['bar'].click()

    It doesn't work in Mozilla or Opera.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Srikanth Pai

      #3
      Re: File Open Dialog Box

      hello Irn,

      Thanks for your reply, on the devdex.com forum.

      Actually, when I click on tbe browse button <input type=file name=bar>.

      I would like the selected file name to be inseted in a text field which
      is placed next to the button.

      I tried using a onclick event but it gets fired before the dialog box is
      displayed so i cannot retrieve the name

      <input type =text name=mytext>
      <input type=file name=bar onclick='fn_tes t()'>.

      function fn_text()
      {
      var my_name = '';
      document.form1. mytext.value = document.form1. bar.click();
      }

      Any Suggestions please.

      Kind Regards,
      Pai.




      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: File Open Dialog Box

        Srikanth Pai <spai@immunetol erance.org> writes:
        [color=blue]
        > hello Irn,[/color]

        That would be LRN (my initials) :)
        [color=blue]
        > Thanks for your reply, on the devdex.com forum.[/color]

        I don't know what the devdex.com forum is, this is a Usenet newsgroup
        and it is not affiliated with devdex.com.
        [color=blue]
        > Actually, when I click on tbe browse button <input type=file name=bar>.
        > I would like the selected file name to be inseted in a text field which
        > is placed next to the button.[/color]

        You can do this with the onchange handler on the file input. See below
        [color=blue]
        > I tried using a onclick event but it gets fired before the dialog box is
        > displayed so i cannot retrieve the name
        >
        > <input type =text name=mytext>
        > <input type=file name=bar onclick='fn_tes t()'>.[/color]

        <form ...>
        <input type="text" name="mytext">
        <input type="file" name="bar"
        onchange="this. form.elements.m ytext.value = this.value">
        </form>

        /L
        --
        Lasse Reichstein Nielsen - lrn@hotpop.com
        Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
        'Faith without judgement merely degrades the spirit divine.'

        Comment

        • Srikanth Pai

          #5
          Re: File Open Dialog Box


          Hello irn,

          <input type="file">

          does not have a event onchange.

          Kind Regards,
          Pai.


          *** Sent via Developersdex http://www.developersdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          • HikksNotAtHome

            #6
            Re: File Open Dialog Box

            In article <smnx8jvh.fsf@h otpop.com>, Lasse Reichstein Nielsen <lrn@hotpop.com >
            writes:
            [color=blue]
            ><form ...>
            ><input type="text" name="mytext">
            ><input type="file" name="bar"
            > onchange="this. form.elements.m ytext.value = this.value">
            ></form>[/color]

            Works in IE6.0, Opera 7, fails in Mozilla 1.4, Firebird 0.6.1and Netscape 7.02.


            --
            Randy
            All code posted is dependent upon the viewing browser
            supporting the methods called, and Javascript being enabled.

            Comment

            • Lasse Reichstein Nielsen

              #7
              Re: File Open Dialog Box

              hikksnotathome@ aol.com (HikksNotAtHome ) writes:
              [color=blue]
              > Works in IE6.0, Opera 7, fails in Mozilla 1.4, Firebird 0.6.1and
              > Netscape 7.02.[/color]

              True. Since my first hint was IE only, I didn't say that the second
              was only tested in IE6 and Opera 7. By mistake.

              /L
              --
              Lasse Reichstein Nielsen - lrn@hotpop.com
              Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
              'Faith without judgement merely degrades the spirit divine.'

              Comment

              Working...