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!!!
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
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.
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>
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:
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
Bookmarks