Access denied tying to submit form with JS?

Discussion in 'HTML' started by Noozer, Jun 5, 2005.

  1. Noozer

    Noozer Guest

    The following javascript code generates an "Access denied" error at the
    indicated line.

    This sample should allow the user to click "Browse" and choose a file. Once
    the user has selected a file the form is automatically submitted. I'm trying
    to avoid having seperate browse and submit actions.

    Can someone explain why I'm getting the error and how I can accomplish this
    task?

    Thx!

    <html>
    <head></head>

    <body>

    <form name="form1" id="form1" method="post" action="test.htm">
    <input type="button" value="Browse" onclick="return vlu();">
    </form>

    <form name="form2" id="form2" method="post" action="test.htm"
    style="display:none;">
    <input type="file" name="file1" id="file1">
    </form>

    <script language="javascript"> <!--
    function vlu() {
    form2.file1.click();
    if (form2.file1.value != "") {
    form2.submit(); //*** ERROR HERE
    }
    }
    //-->
    </script>
    </body>
    </html>
    Noozer, Jun 5, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Spiegel

    Tying the pieces (files) together

    John Spiegel, Aug 27, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    367
    John Spiegel
    Aug 29, 2003
  2. Dan Manes
    Replies:
    1
    Views:
    729
    David Browne
    Apr 23, 2006
  3. Replies:
    9
    Views:
    1,120
    Ralf Hildebrandt
    Mar 29, 2007
  4. Mike G

    Tying Script Exectution Time to a Scrpt

    Mike G, Feb 1, 2005, in forum: ASP General
    Replies:
    0
    Views:
    118
    Mike G
    Feb 1, 2005
  5. David Gonneau
    Replies:
    3
    Views:
    239
Loading...

Share This Page