"Access Denied" submitting form with Javascript?

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

    "Access Denied" submitting form with Javascript?

    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.ht m">
    <input type="button" value="Browse" onclick="return vlu();">
    </form>

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

    <script language="javas cript"> <!--
    function vlu() {
    form2.file1.cli ck();
    if (form2.file1.va lue != "") {
    form2.submit(); //*** ERROR HERE
    }
    }
    //-->
    </script>
    </body>
    </html>




  • Danny

    #2
    Re: &quot;Access Denied&quot; submitting form with Javascript?


    Correct, the type="file" input element gives little access, reason why is
    security, so, chances are, access is denied to many of its objects as well
    as .click() method, run a For In on it maybe, to see which you can access,
    but most do not give access due to security.

    Danny

    On Sun, 05 Jun 2005 13:03:39 -0700, Noozer <dont.spam@me.h ere> wrote:





    --
    Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

    Comment

    • Lee

      #3
      Re: &quot;Access Denied&quot; submitting form with Javascript?

      Noozer said:[color=blue]
      >
      >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.[/color]

      Besides the security issue, what if I just accidentally release
      the mouse button over the wrong file? You don't want to make it
      too easy to make a potentially serious mistake.

      Comment

      Working...