Page reload on form submission with Javascript alert stops page from rendering
In the attached HTML file... if you fill out this form, it points to itself for validation on the server side. If not all required fields are filled in, in the <head> area this is inserted:
<script language="javascript" type="text/javascript">
alert ("One or more required fields was not filled in, please answer all questions.");
</script>
The rest of the page is just HTML. In all browsers EXCEPT Firefox, this works fine and the form is redisplayed so the user can fill in the required fields. However, most of the time, in Firefox... I just get a blank white screen. The attached file is the page source when this happens. The code looks fine, but Firefox stops rendering the page for some reason. I can't get any other browser to do this, and it happens in both Windows and Mac versions of Firefox.
Why alert? Insert it on the page instead in a bold red header
Brad Bansner
ASKER
The alert gets people's attention. Although your comment may be accurate, it doesn't explain why this is happening in the first place. It shouldn't be a problem, and I have used this same technique for years on many websites, so its sort of a big concern for me.
dxdinh
If you use classic ASP then after the Response.Write ("<script> alert ('....')</script>")
do a Response.End
or if you set buffer = true the do the Response.flush
The response buffer controls what the server is sending to the client, but it has nothing to do with the actual final rendering of the page, does it? That wouldn't change the page source at all.