Bug 368

Summary: multiple submit problem in IE
Product: Chameleon Reporter: Bart van den Eijnden <bartvde@osgis.nl>
Component: CoreAssignee: chameleon-dev <chameleon-dev@lists.maptools.org>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 1.99   
Target Milestone: 2.0 Final   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description From 2004-05-06 13:32:08
we have made some changes in Chameleon to prevent the multiple submit
crash of Chameleon in Internet Explorer. The main problem was the form
could be submitted when the page was not fully loaded.

Basically, what we have done is the following:

create a mySubmit() function in the HTML template:

var bBusy = true;

function mySubmit()
{
  if (! bBusy)
  {
    bBusy = true;
    document.forms[0].submit();
  }
}

on the OnLoad function of the body we set bBusy to false.

In all the widgets we have replaced document.forms[0].submit() with a call
to mySubmit().

Hopefully you can implement this in a more generic way during the
Javascript redesign for Chameleon 2.0.
------- Comment #1 From 2004-05-21 10:03:48 -------
I was thinking about how to do this.  One way would be to do it in the way you
suggest here which is to provide a generic submit function which all widgets
would call.  This would necessitate changes to almost every widget, a lot of work :(

I'm going to suggest another way which can be implemented by the user with no
changes to widgets.  Essentially, I want you to try this:

<script language="Javascript">
var pageLoaded = false;
function myOnload()
{
   pageLoaded = true;
   CWC2OnLoadFunction();
}

function mySubmit()
{
    //returning false prevents the form from being submitted.
    return pageLoaded;
}
</script>

<body onload="myOnLoad();">
<form onsubmit="mySubmit();">

... widgets here ...

</form>
</body>

if this works then I would suggest that we make this a documentation/known
problems issue and make sure that this is recorded 
------- Comment #2 From 2004-05-21 10:16:10 -------
Set Target Milestone to 1.99 Final
------- Comment #3 From 2004-05-21 16:23:01 -------
Hi Paul, I checked this approach and it seems to work. Great!

------- Comment #4 From 2004-06-24 11:24:42 -------
has this bug been fixed? Bart's last comment seems to think so.