By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,940 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,940 IT Pros & Developers. It's quick & easy.

Form has no properties in Firefox

rrocket
100+
P: 116
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:
Expand|Select|Wrap|Line Numbers
  1. <TITLE>ASPXTOASP.aspx</TITLE>
  2. <script language="C#" runat="server">
  3.  
  4. private void Page_Load(object sender, EventArgs e){
  5. //We grab all the session variable names/values and stick them in a form
  6. // and then we submit the form to our receiving ASP page (ASPTOASPX.asp)...
  7.  
  8.     Response.Write("<form name=t id=t action=ASPXTOASP.asp method=post>");
  9.  
  10.  foreach(object it in Session.Contents)
  11.     {
  12.         Response.Write("<input type=hidden name=" + it.ToString());
  13.         Response.Write(" id=" + it.ToString());
  14.         Response.Write( " value=" + Session[it.ToString()].ToString() + " >");
  15.     }
  16.  
  17. if (Request.QueryString["destpage"] !=null)
  18. Response.Write("<input type=hidden name=destpage value=" +Request.QueryString["destpage"].ToString() +">");
  19. Response.Write("</FORM>");
  20. Response.Write("<scr" + "ipt>t.submit;</scr" + "ipt>");
  21. }
  22.  
  23. </script>
  24.  
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.getElementById("t").value.submit, etc, and nothing is working.

Thanks!
Nov 6 '07 #1
Share this Question
Share on Google+
7 Replies


acoder
Expert Mod 15k+
P: 16,027
Try document.forms[0].submit() or document.getElementById("t").submit()

forms(0) is incorrect syntax.
Nov 6 '07 #2

rrocket
100+
P: 116
Thanks for responding...

document.getElementById("t").submit() and document.forms[0].submit() both give me a "has no properties" error in Firefox.
Nov 6 '07 #3

acoder
Expert Mod 15k+
P: 16,027
How does this code turn out on the client-side?
Nov 6 '07 #4

rrocket
100+
P: 116
Expand|Select|Wrap|Line Numbers
  1. <form name=t id=t action=ASPXTOASP.asp method=post><input type=hidden name=username id=username value=cpio@email.com ><input type=hidden name=password id=password value=mypassword ><input type=hidden name=destpage value=login.asp></FORM><script>t.submit();</script><TITLE>ASPXTOASP.aspx</TITLE>
Everything is there... I just need to get the values of the form to submit.
Nov 6 '07 #5

rrocket
100+
P: 116
Is that what you were looking for or something else?
Nov 6 '07 #6

rrocket
100+
P: 116
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".
Nov 6 '07 #7

100+
P: 210
Expand|Select|Wrap|Line Numbers
  1. <form name=t id=t action=ASPXTOASP.asp method=post><input type=hidden name=username id=username value=cpio@email.com ><input type=hidden name=password id=password value=mypassword ><input type=hidden name=destpage value=login.asp></FORM><script>t.submit();</script><TITLE>ASPXTOASP.aspx</TITLE>
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.
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>ASPXTOASP.aspx</title>
  4. </head>
  5. <body>
  6. <form name=t id=t action='ASPXTOASP.asp' method=post>
  7. <input type=hidden name=username id=username value=cpio@email.com >
  8. <input type=hidden name=password id=password value=mypassword >
  9. <input type=hidden name=destpage value=login.asp>
  10. </form>
  11. <script>document.forms['t'].submit();</script>
  12. <body>
  13. </html>
  14.  
Nov 7 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.