Link to home
Start Free TrialLog in
Avatar of purplesoup
purplesoupFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Using window.onLoad = or window.onLoad +=

I'm trying to avoid ViewState Mac errors and one of the solutions is to disable the form and re-enable it when the page loads to prevent premature submissions of the form before it has finished loading (see here for a good discussion of the options - http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx)

To enable the form again the above page has this:

  function enableForm() { 
      document.getElementById("form").disabled = false; 
  } 

  window.onLoad = enableForm();

Open in new window


I wasn't sure if this would replace any existing window.onLoad event handlers, and if you are supposed to enter

  window.onLoad += enableForm();

and if you are supposed to do this whether it would put "enableForm()" as the first function called after onLoad?
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of purplesoup

ASKER

Excellent - thanks!