Form validation in NN4 when form in DIV - TechRepublic
General discussion
August 2, 2003 at 12:36 AM
mr. origami

Form validation in NN4 when form in DIV

by mr. origami . Updated 22 years, 10 months ago

I attach a Javascript form validator to my form and it works great – unless the form is in a DIV tag and I use Netscape 4 (Windows). It validates – I get alert boxes with the error message – but the form still submits!
My page is simple:
<.body>
<.div id="Layer1" style="position:absolute; left:50px; top:53px; width:101px; height:46px; z-index:1">
<.form action="otherpage.htm" method="post" name="form1" onSubmit="return validate();">
<.input type="text" name="textfield">
<.input type="submit" name="Submit" value="Submit">
<./form>
<./div>
<./body>

(NOTE: The “dots” were added above in the tags so my post does not contain HTML code. They do not appear in my actual page code!)

See – nothing but a single form with a single textfield. Move the form out of the DIV tag – it works fine. Put form back in DIV tag – it doesn’t work (validates, but never “returns false” – it still submits)!

How can I validate a form that’s inside a layer?!?!

This discussion is locked

All Comments