XHTML and Forms

liunx

Guest
Ok, the code that follows doesn't validate. Why can't I have <label> tags within a form? Seems like it should be acceptable. I've seen examples like that. Is it because I'm using XHTML 1.0 Strict? If so, how should I structure it?<br />
<br />
<br />
<div class="rightSideDiv"><br />
<h3 class="rightTitle">User Log-In</h3><br />
<form action="identityChecky.jsp" method="post" id="login"><br />
<label class="rightFormLabel">User Name:</label><br />
<input class="tfield" type="text" name="username" id="username" onkeypress="return handleEnter(this,event)"/><br />
<br/><br />
<label class="rightFormLabel">Password:</label><br />
<input class="tfield" type="password" name="password" id="password"/><br />
<br/><br />
<span class="center"><input class="submitButton" type="submit" value="Log In"/></span><br />
</form><br />
</div><!--content-->You have to add in <fieldset> tags.<br />
<br />
<div class="rightSideDiv"><br />
<h3 class="rightTitle">User Log-In</h3><br />
<form action="identityChecky.jsp" method="post" id="login"><br />
<fieldset><br />
<label class="rightFormLabel">User Name:</label><br />
<input class="tfield" type="text" name="username" id="username" onkeypress="return handleEnter(this,event)"/><br />
<br/><br />
<label class="rightFormLabel">Password:</label><br />
<input class="tfield" type="password" name="password" id="password"/><br />
<br/><br />
<span class="center"><input class="submitButton" type="submit" value="Log In"/></span><br />
</fieldset><br />
</form><br />
</div><!--content-->I found that out after looking through the specs more, the problem with that is that I didn't want to see the fieldset or legend, so i set legend to display:none and the fieldset to have margin:0, padding:0, border-width:0. So now it looks as if nothing is there. Yippie.<!--content-->Alright. I like fieldsets though... I don't know on which computers/ browsers this occurs, but on mine it automatically has rounded borders, without any images or excess code.<!--content-->It doesn't actually have to be <fieldset>, it just has to be a block-level element. So you could use a <div> instead, which is what I usually do.<!--content-->True. But they look all nice and form-y when u do use fieldsets.<!--content-->
 
Back
Top