www.webdeveloper.com
Results 1 to 8 of 8

Thread: Submit works, then fails on Macs

  1. #1
    Join Date
    Apr 2004
    Posts
    8

    Submit works, then fails on Macs

    Hi:
    This one is a strange os/browser question. Only on Mac (I'm testing with OSX), and more frequently with Mozilla rather than IE, I get the weirdest behavior. After several forms have been submitted from different pages, all of a sudden the forms will not submit!

    Code sample:

    <code>
    function SetTaskAndPost(pTask)
    {
    if (intPosted == 0)
    {
    intPosted = 1;
    document.forms[0].Task.value = pTask;
    document.forms[0].submit();
    return true;
    }
    }

    </code>

    This code is in an include file used by all pages in the site. I put a few alerts in, including just before and after the submit(). I get the alerts, but the submit action does not take place.

    This is a commercial product and is currently live with this bug, so speedy replies are much appreciated!!!

    Dan Walter
    Dan Walter
    Senior Software Engineer
    ASEBA

  2. #2
    How are you calling the function? Are you using the onSubmit event on the <form> tag or via a button?

  3. #3
    Join Date
    Apr 2004
    Posts
    8
    requestcode:
    The function is called in a button, as follows:

    <td width="210" valign="top" background="Spacerblue1x1.gif"> <a class="NAVLINK" href="#" onClick="javascript:SetTaskAndPost('back');return false;" onMouseOver="self.status='Back'; return true" border="0"><LBLXXX>< BACK</LBLXXX></a></td>

    There are some specific client side functions for each page (to validate data entered). These also issue the submit() command, which then fails as well

    Dan
    Dan Walter
    Senior Software Engineer
    ASEBA

  4. #4
    Sometimes I have had problems when using the void "#" character in the href. You might try putting your function call in there like this:
    href="javascript:SetTaskAndPost('back');"

    You would of course remove the onClick event. Also when using events like the onClick you do not need to include "javascript:" before the function call.

  5. #5
    Join Date
    Apr 2004
    Posts
    8
    requestcode:

    No soap. The code still runs fine the first half dozen times, then just seemingly will not submit the form.

    I made the following changes for my testing.

    // DECLARATION WAS IN ORIGINAL CODE, NOT IN EXAMPLE.
    var intPosted = 0;

    function SetTaskAndPost(pTask)
    {
    // EVEN WHEN THE FORM IS NOT SUBMITTED, I STILL GET THE ALERT "0 is intPosted" - just wanted to make sure the value wasn't getting passed around.
    strText = intPosted + '';
    strText = strText + " is intPosted";
    alert(strText);
    if (intPosted == 0)
    {
    intPosted = 1;
    document.forms[0].Task.value = pTask;
    document.forms[0].submit();
    return true;
    }
    }

    // AND CHANGES TO THE <A> TAG
    // NEW HREF DECLARATION href="javascript:SetTaskAndPost('back');"
    <a class="NAVLINK" href="javascript:SetTaskAndPost('back');" onMouseOver="self.status='Back'; return true" border="0"><LBLXXX>< BACK</LBLXXX></a>

    Dan
    Dan Walter
    Senior Software Engineer
    ASEBA

  6. #6
    Sorry I can't be of more help. I don't have a Mac to test on so I can only guess. That sure is not much help. I did find this resource that might have some things that could help:

    http://developer.apple.com/internet/...ent/index.html

    It is a developer site for Apple. Good Luck.

  7. #7
    Join Date
    Apr 2004
    Posts
    8
    Thanks for the help - this one is tricky. I'll check the apple site for what it's worth (if I hear one more word about how great Safari is, I think I'll scream! ).
    Dan
    Dan Walter
    Senior Software Engineer
    ASEBA

  8. #8
    I did not think of this before, but you might try posting this in the forums here:
    http://www.codingforums.com/

    There are some people over their that are pretty knowledgable about this stuff.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles