IE6 dom manipulation onSubmit fails

T

tim

Hello All,

I have a problem I have not been able to resolve with a webbased
project I am working on for work (not fun).

The scenario is this: I have a search that can take quite some time
depending on the search parameters, so I would like to be able to let
the user know their data is coming they just need to sit back and wait
a couple of seconds.

To do this, I cover the form with a <div> while the search is taking
place. Seems simple enough. So simple it works in Firefox and
Konqueror (yeah im a linux) guy. But when I try it on IE6, the status
bar looks likes it had loaded a page, the page sits their without the
div showing, then the results page is rendered. I have used the script
debugger in IE and determined the code is actually executing, but the
div is not being rendered. Is this a result of how IE handles
rendering after submitting or some other craziness ?

Below are excerpts from my code.....

function loading(msg,status) {

swapDOM("statusmessage",DIV({'id':'statusmessage'},DIV({'class':status},P({'class':'statusText'},msg))));
callLater(1, loading, msg+' . ', status);
return true;
}


function doSearch(){
//SEARCHING is a global variable I use as a fix to prevent double
submitting in IE since the div doesnt show
if (SEARCHING==false){
loading("Searching",'search');
document.search.submit();
SEARCHING=true;
return true;
}
else{
return false;
}
}


<form method='post' id='search' name='search' action="'/search"
onSubmit="javascript: return doSearch();">
....
....
...
</form>

Thanks in advance for any help,

Tim
 
R

RobG

tim said on 29/03/2006 9:34 AM AEST:
Hello All,

I have a problem I have not been able to resolve with a webbased
project I am working on for work (not fun).

The scenario is this: I have a search that can take quite some time
depending on the search parameters, so I would like to be able to let
the user know their data is coming they just need to sit back and wait
a couple of seconds.

To do this, I cover the form with a <div> while the search is taking
place. Seems simple enough. So simple it works in Firefox and
Konqueror (yeah im a linux) guy. But when I try it on IE6, the status
bar looks likes it had loaded a page, the page sits their without the
div showing, then the results page is rendered. I have used the script
debugger in IE and determined the code is actually executing, but the
div is not being rendered. Is this a result of how IE handles
rendering after submitting or some other craziness ?

Pretty sure this is a manifestation of IE's 'stop the GUI' phenomenon
whenever navigation is initiated. As soon as it detects navigation to a
new page, any GUI stuff stops. It's usually an issue with using script
in the image href attribute.

So while your script runs, as soon as the navigation is initiated, the
GUI stops. You might try firing the submit from setTimeout() - but that
seems a bit messy.

e.g.

function doSearch()
{
if (SEARCHING == false){
loading(...);
SEARCHING = true;
setTimeout(function(){document.search.submit();},10)
}
return false;
}
Below are excerpts from my code..... [...]
function doSearch(){
//SEARCHING is a global variable I use as a fix to prevent double
submitting in IE since the div doesnt show
if (SEARCHING==false){
loading("Searching",'search');
document.search.submit();
SEARCHING=true;
return true;
}
else{
return false;

'else' is redundant, just return false.

}
}


<form method='post' id='search' name='search' action="'/search"
onSubmit="javascript: return doSearch();">

Ditch the 'javascript:' label.

[...]
 
R

RobG

RobG said on 29/03/2006 2:25 PM AEST:
[...]
It's usually an issue with using script in the image href attribute.

That should be link (A element) href of course... :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top