Help - Search - Members - Calendar
Full Version: Form problem in Firefox?
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
joarc
Hi all, thanx for having a look at my post. I snagged some free script off the web for creating a simple email form (I'm using it in Dreamweaver 8). I just tweaked the values some and I've also got an image on a layer and left the rest the way it was. Problem is, the two radio buttons I have work fine in IE but the first radio button is already preselected in FF and I cannot select the other button. Here's the script below and thank you so much for your help!

<!-- ADD INTRODUCTORY TEXT -->
<strong>namehere<br />
Tel. (000) 000-0000 Fax. (000) 000-0000<br />
Telephone hours: Monday through Friday 10:00am to 4:00pm</strong> <br />
<br />
Please call or fill out the form below. If you make a mistake please click on the &quot;Clear Form&quot; button to start over. <br />
Be sure to click on the &quot;Submit&quot; button after filling out the form. </p>
<table width="442">
<tr>
<td width="215"><label><strong>First Name
</strong>
<input type="text" name="FirstName" />
</label></td>
<td width="215"><label><strong>Last Name</strong>
<input type="text" name="LastName" />
</label></td>
</tr>
<tr>
<td height="25"><label><strong>Email Address</strong>
<input type="text" name="EmailAddress" />
</label></td>
<td><label><strong>Telephone</strong>
<input type="text" name="Telephone" />
</label></td>
</tr>
<tr>
<td height="25" colspan="2"><strong>How do you prefer we contact you?</strong><br />
<label>
<input name="radiobutton" type="radio" value="EMAIL" />
Email
<input name="radiobutton" type="radio" value="TELEPHONE" />
Telephone</label></td>
</tr>
<tr>
<td height="25" colspan="2"><label><strong>Questions or Comments</strong>
<textarea name="textarea"></textarea>
</label></td>
</tr>
</table>
<div id="Layer1"><img src="images/Help_key.jpg" width="200" height="161" /></div>
<p>&nbsp;<br />
&nbsp;<br clear="all" />
<input type="submit" name="Submit" value="Submit" />
<input type="reset" name="Reset" value="Clear Form" />
</p>
</form>
pandy
You have included both radio buttons in the same label.

HTML
<label>
<input name="radiobutton" type="radio" value="EMAIL" />
Email
<input name="radiobutton" type="radio" value="TELEPHONE" />
Telephone</label>


When you click anywhere inside the label element, for example on the word "telephone" the form control associated with the label will be selected. Only there are two form controls, so FF makes the logical decision to select the first one.

IE doesn't support this way of association labels with form controls so it does nothing. It needs the 'for' attribute. Not totally sure if this is true for IE7, but it is for IE6-.
joarc
omg... that was too easy! THANK YOU SO MUCH!!!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.