[ACCEPTED]-Radio button only renders radio button not text-radio-button

Accepted answer
Score: 10

Works as defined. To specify radio button 10 text, include it as textual content, preferably 9 using label markup (though this is not formally 8 required):

<input type="radio" id="rdoHalfDay" name="rdoHalfDay" value="Half Day" />
<label for="rdoHalfDay">Half day</label>

Note that the value of the value attribute 7 of a input type="radio" only specifies the data to appear 6 in the form data submitted (and could be 5 anything that you can conveniently handle 4 in your software). It is not supposed to 3 appear and will not normally appear as visible 2 content (except if the form handling software 1 has been written to “echo” it to the user).

Score: 5

The text inside the value attribute is only 8 the value that gets sent to the server if 7 that radio button happens to be checked 6 at the time of submission. It doesn't actually 5 get displayed on the page. This is useful 4 in case you use compressed versions of the 3 corresponding text as the values in your 2 server, which would represent the full text, like 1 so:

<label><input type="radio" name="rdo" value="HalfDay" /> Half Day</label>
Score: 1

Radio buttons don't work like that. The 4 text is specified outside the tag. The value 3 is what is passed back to the server when 2 the form is submitted. See the following 1 example:

<form name="myform" action="http://www.mydomain.com/myformhandler.cgi" method="POST">
  <div align="center"><br>
    <input type="radio" name="group1" value="Milk"> Milk<br>
    <input type="radio" name="group1" value="Butter" checked> Butter<br>
    <input type="radio" name="group1" value="Cheese"> Cheese
    <hr>
    <input type="radio" name="group2" value="Water"> Water<br>
    <input type="radio" name="group2" value="Beer"> Beer<br>
    <input type="radio" name="group2" value="Wine" checked> Wine<br>
  </div>
</form>

See: http://www.echoecho.com/htmlforms10.htm

Score: 0
<label for="lDIV1">
<input id="lDIV1" type="radio" name='rbtab' value='DIV1' onclick="javascript:custom()" 
/>Create
Email:</label>
<label for="lDIV2">
<input id="lDIV2" type="radio" name='rbtab' checked="checked"  value='DIV2' 
onclick="javascript:defaul()" />Default
Email:</label>
<div id='Content' style="display: block">

For Radio button

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

0

More Related questions