SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2004
    Location
    Winnipeg Canada
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript Submit - Works in IE not Firefox

    Javascript is not my world! I apologize for what is likely a silly question

    I have a page that must redirect to a new location - after all the form data is collected. The page is written in ASP, and must be submitted by POST to move all the data to a new location.

    I setup JavaScript to do the form submit, at the end of the page.
    This works 100% in IE! The problem is, Firefox does not do anything. It just sits on the redirect page.

    <SCRIPT LANGUAGE="javascript">
    <!--
    document.forms("form1").submit()
    //--></SCRIPT>

    Any idea why this doesn't work in FireFox?
    Thanks.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    We seem to only have half of what we need here. What does the form look like?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2004
    Location
    Winnipeg Canada
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry - I didn't think it was necessary since it is the JS not working with Firefox. It works absolutely fine with IE.

    Here is the form followed by the JavaScript code. Obviously I replaced a few values from the actual form, but essentially this is it.

    ------------
    <form name="form1" id="form1" method="post" action="https://lets_go_to_some_URL.php">
    <table width="50%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <!-- Data Collection -->
    <input name="idvalue" type="hidden" id="idvalue" value="<%=(Response.Write(idvalue))%>" size="50" />
    <input name="gsMT" type="hidden" id="gsMT" value="<%=(Response.Write(gsMT))%>" size="50" />
    <input name="success" type="hidden" id="success" value="<%=(Response.Write(success))%>" size="50" />
    <input name="fail" type="hidden" id="fail" value="<%=(Response.Write(fail))%>" size="50" />
    <input name="amount" type="hidden" id="amount" value="<%=(Response.Write(amount))%>" size="50" />
    <input name="email" type="hidden" id="email" value="<%=(Response.Write(email))%>" size="50" />
    <input name="key" type="hidden" id="key" value="<%=(Response.Write(key))%>" size="50" /></td>
    </form>
    <SCRIPT LANGUAGE="javascript">
    <!--
    document.forms("form1").submit()
    //--></SCRIPT>
    ------------

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Thanks for helping to confirm it wasn't some other issue.

    Change the parenthesis to brackets and you'll be right.

    Code javascript:
    document.forms["form1"].submit();
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Zealot
    Join Date
    Feb 2004
    Location
    Winnipeg Canada
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That did it
    Thanks for your help - greatly appreciated.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •