Form has no properties in Firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rrocket
    New Member
    • Aug 2007
    • 116

    Form has no properties in Firefox

    I am trying to submit a form with .submit(), but I am having issues passing the values from my form...

    Here is what I have so far:
    [code=c#]
    <TITLE>ASPXTOAS P.aspx</TITLE>
    <script language="C#" runat="server">

    private void Page_Load(objec t sender, EventArgs e){
    //We grab all the session variable names/values and stick them in a form
    // and then we submit the form to our receiving ASP page (ASPTOASPX.asp) ...

    Response.Write( "<form name=t id=t action=ASPXTOAS P.asp method=post>");

    foreach(object it in Session.Content s)
    {
    Response.Write( "<input type=hidden name=" + it.ToString());
    Response.Write( " id=" + it.ToString());
    Response.Write( " value=" + Session[it.ToString()].ToString() + " >");
    }

    if (Request.QueryS tring["destpage"] !=null)
    Response.Write( "<input type=hidden name=destpage value=" +Request.QueryS tring["destpage"].ToString() +">");
    Response.Write( "</FORM>");
    Response.Write( "<scr" + "ipt>t.subm it;</scr" + "ipt>");
    }

    </script>
    [/code]

    As luck would have it, I have no problems with this in IE. I have tried everything that I can think of to get it to work in Firefox... document.forms( 0).submit(), document.getEle mentById("t").v alue.submit, etc, and nothing is working.

    Thanks!
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Try document.forms[0].submit() or document.getEle mentById("t").s ubmit()

    forms(0) is incorrect syntax.

    Comment

    • rrocket
      New Member
      • Aug 2007
      • 116

      #3
      Thanks for responding...

      document.getEle mentById("t").s ubmit() and document.forms[0].submit() both give me a "has no properties" error in Firefox.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        How does this code turn out on the client-side?

        Comment

        • rrocket
          New Member
          • Aug 2007
          • 116

          #5
          [code=html]<form name=t id=t action=ASPXTOAS P.asp method=post><in put type=hidden name=username id=username value=cpio@emai l.com ><input type=hidden name=password id=password value=mypasswor d ><input type=hidden name=destpage value=login.asp ></FORM><script>t. submit();</script><TITLE>A SPXTOASP.aspx</TITLE>[/code]

          Everything is there... I just need to get the values of the form to submit.

          Comment

          • rrocket
            New Member
            • Aug 2007
            • 116

            #6
            Is that what you were looking for or something else?

            Comment

            • rrocket
              New Member
              • Aug 2007
              • 116

              #7
              If anyone has another other ideas I am definitely open... I am trying to pass session variables from an ASPX page to an ASP page. Like I mentioned before it works fine in IE, but not in Firefox. If it could be rewritten in javascript or something else please let me know. The major issue that I am having is getting the form values t not to cause a "has no properties error".

              Comment

              • Logician
                New Member
                • Feb 2007
                • 210

                #8
                Originally posted by rrocket
                [code=html]<form name=t id=t action=ASPXTOAS P.asp method=post><in put type=hidden name=username id=username value=cpio@emai l.com ><input type=hidden name=password id=password value=mypasswor d ><input type=hidden name=destpage value=login.asp ></FORM><script>t. submit();</script><TITLE>A SPXTOASP.aspx</TITLE>[/code]

                Everything is there... I just need to get the values of the form to submit.
                t.submit() is invalid syntax, which I.E. will accept.
                The problem is that you're not generating valid HTML and therefore the forms collection has length 0.
                [code=html]
                <html>
                <head>
                <title>ASPXTOAS P.aspx</title>
                </head>
                <body>
                <form name=t id=t action='ASPXTOA SP.asp' method=post>
                <input type=hidden name=username id=username value=cpio@emai l.com >
                <input type=hidden name=password id=password value=mypasswor d >
                <input type=hidden name=destpage value=login.asp >
                </form>
                <script>documen t.forms['t'].submit();</script>
                <body>
                </html>
                [/code]

                Comment

                Working...