Thursday, December 07, 2006

Validators - here's a weird one...

I'm looking after some code for someone and had to change a static HTML page into an ASP.NET 2.0 form, adding a new section to the page that validates before it posts the page.

In Firefox the validators fired correctly and then the page was posted back (if valid obviously).  In Internet Explorer the validators fired but the page was never posted back (even if the page was valid).

After a couple of hours I managed to track down the problem.  The page already had a client side <form> which was now contained within the ASP.NET <form> like so:

<form id="form1" runat="server">
  <form id="site_search" action="">

Internet Explorer seems to be unable to post this back and doesn't give an error whereas Firefox posts back correctly.

Really annoying that something so simple could take so long to fix but when the validator code is explicitly looking for "form1" then it really should find the one it wants and be able to submit it?

No comments: