Click to See Complete Forum and Search --> : Submit works, then fails on Macs
DanWalter
04-07-2004, 10:21 AM
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
requestcode
04-07-2004, 11:00 AM
How are you calling the function? Are you using the onSubmit event on the <form> tag or via a button?
DanWalter
04-07-2004, 11:07 AM
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
requestcode
04-07-2004, 11:13 AM
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.
DanWalter
04-07-2004, 12:45 PM
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
requestcode
04-07-2004, 01:48 PM
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/webcontent/index.html
It is a developer site for Apple. Good Luck.
DanWalter
04-07-2004, 02:22 PM
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 :eek:
requestcode
04-07-2004, 02:28 PM
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.