Radio buttons and FormMail


Author Message
Jim Johnson

Posted: 4/28/2014
Quote message 

I am trying to create a form with radio buttons and check boxes, to be processed by FormMail. Everything seems to be set up properly but FormMail is unable to extract the values from the radio buttons and check boxes. I dropped in some sample code that uses unstyled radio buttons, and these are read properly. Code is below. Does anyone have a suggestion?

<p><form action="http://www.animalhealthassociates.org/formmail.php" method="post">
<input type="hidden" name="recipients" value="clientcare@animalhealthassociates.org">
<input type="hidden" name="subject" value="Appointment Request">
<input type="hidden" name="redirect" value="../contact/success.html">
<p><input type="text" placeholder="Your Name" name="realname">&nbsp;&nbsp;<input type="email" placeholder="Email" name="email">&nbsp;&nbsp;<input type="text" placeholder="Phone" name="phone"><br></p><p><input type="text" placeholder="Pet's Name" name="petsname">&nbsp; &nbsp;<label class="art-radiobutton"><input type="radio" name="species" value="Dog">&nbsp;Dog&nbsp;&nbsp;&nbsp;</label>&nbsp;<label class="art-radiobutton art-checked"><input type="radio" name="species" value="Cat" checked="checked">&nbsp;Cat&nbsp;&nbsp;</label><label class="art-checkbox art-checked"><input type="checkbox" name="new_patient" value="New" patient="" checked="checked">&nbsp;&nbsp;Is this a new patient?</label></p><p><textarea placeholder="Comments" name="comments" style="width:80%" rows="5"></textarea></p>
<tr>
<td><p>May we contact you?</p>
</td>
<td>
<label>Yes <input type="radio" name="contact" value="Y" checked="checked" /></label>
<label>No <input type="radio" name="contact" value="N" /></label>
</td>
</tr>

<input type="submit" value="Submit" class="art-button" style="zoom: 1;"></form></p>
 
Alfonso

Posted: 5/5/2014
Quote message 

<input type="radio" name="sex" value="male">Male<br>
<input type="radio" name="sex" value="female">Female

Try this syntax the sample is from http://www.w3schools.com/html/html_forms.asp

I use it all the time
 
Imre Beke

Posted: 8/2/2014
Quote message 

Yes, there is a solution. It involves the "for" attribute of the "<label>" tag and the "id" attribute of the "<input>" tag.

1. The "<input>" tag must have an "id" attribute.
2. The "id" attribute CANNOT be the same as the "name" attribute. The "name" attribute identifies the entire radio button collection while the "id" attribute identifies the individual radio button controls within the collection.
3. The "for" attribute in the "<label>" tag must match the "id" attribute of the corresponding "<input>" control in order to link the two.

So, for example:

<p>
Please choose a color:
</p>

<p>
<label class="art-radiobutton" name="colorChoice" for="colorChoiceRed">
<input type="radio" name="colorChoice" id="colorChoiceRed" value="Red">
Red
</input>
</label>

<br>

<label class="art-radiobutton" name="colorChoice" for="colorChoiceBlue">
<input type="radio" name="colorChoice" id="colorChoiceBlue" value="Blue">
Blue
</input>
</label>

<br>

<label class="art-radiobutton" name="colorChoice" for="colorChoiceGreen">
<input type="radio" name="colorChoice" id="colorChoiceGreen" value="Green">
Green
</input>
</label>

<br>

</p>


In this example, the individual "<label>" tags and the "<input>" tags inside them are linked through their respective "for" and "id" attributes.

It would be nice if Artisteer allowed us to manipulate the individual "id" and "name" attributes through a dialogue box and created the nested "<label>" and "<input>" tags with the attributed formed in the appropriate manner but doing it by had is not all that difficult, once it becomes clear how the control and the label are linked.
 
Ruth

Posted: 2/1/2015
Quote message 

According to the script.js when a checkbox is checked a class "checked" is applied. but I cannot find such a style in the css file so checkboxes do not work correctly. An image is placed over the checkbox and presumably the checkbox remains unchecked.
Looks like a bug to me.