Why doesn't the radio button "check"?

Discussion in 'HTML & Website Design' started by amaze, Jul 12, 2007.

  1. #1
    Hi,

    Why doesn't the second radio button "check" below? The first disabled OK. This is in a <form> tag, just snipped this out.. :)

    Thanks


    <table width="100%" border="0" cellspacing="1" cellpadding="1">			
    			<tr>
    			<td valign="top">
    
    			<input type="radio" name="ingredientDetailsId" value="387"   disabled="disabled" onChange="swapPrice('&pound;11.99');" /> <span class="smallText"><strong><span class="sale">60 Capsules<span></span> </strong></span></td></tr>
    
    			<tr>
    			<td valign="top">
    			<input type="radio" name="ingredientDetailsId" value="388"  checked="checked"  onChange="swapPrice('&pound;18.99');" /> <span class="smallText"><strong>270 Capsules </strong></span></td>	
    </tr></table>
    Code (markup):

     
    amaze, Jul 12, 2007 IP
  2. PHPGator

    PHPGator Banned

    Messages:
    4,437
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    260
    #2
    I believe you are doing it wrong... the format is <input type="radio" name="something" CHECKED>

    It actually doesn't have an internal variable (i guess this is whaty ou would call it?) set for it. Looks odd, but works. ;)
     
    PHPGator, Jul 12, 2007 IP
  3. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #3
    It works fine for me:

    [​IMG]
     
    VimF, Jul 12, 2007 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    And you have to add a value to checked if using XHTML (checked="checked").

    If you don't mind me asking, why are you using a table to lay yout your form anyway?
     
    Dan Schulz, Jul 12, 2007 IP
  5. amaze

    amaze Active Member

    Messages:
    594
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #5
    Thanks guys... :)

    Dan: Why how else would I do it? CSS? I suppose I'm stuck in a time warp... Do you feel its worth while me learning CSS inside-out for positioning instead?
     
    amaze, Jul 12, 2007 IP
  6. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #6
    In a nutshell, yes. Tell you what. Show me the full HTML code for your form and I'll re-code it for you using semantic HTML and CSS for you.
     
    Dan Schulz, Jul 12, 2007 IP
  7. Brent H

    Brent H Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Where were you when I was designing my site? ;)
     
    Brent H, Jul 12, 2007 IP
  8. amaze

    amaze Active Member

    Messages:
    594
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #8
    Sounds like a plan! I will then use the same style on future designs. I did make the site 4 years ago so maybe CSS wasn't the way to go then. Its not very large but will make good learning\reading for me! :)

    <table width="150" border="0" cellspacing="0" cellpadding="2" style="padding: 0px 0px 0px 0px;" >
    	
    	
    	
    		
    			
    		
    		
    		
    		
    		<tr>
    			<td class="defaultBold">Price:</td>
    			<td colspan="2"><span id="mySpan" style="font-size:15px; font-weight:bold;">&pound;12.99</span><strong></td>			
    		</tr>	
    			
    		<tr>
    			<td  ><strong>Amount:</strong></td>
    
    			<td>
    			
    			<select name="amount">
    				
    				
    				
    									
    				<option value="1" selected>1</option>						
    									
    				<option value="2" >2</option>						
    									
    				<option value="3" >3</option>						
    									
    				<option value="4" >4</option>						
    									
    				<option value="5" >5</option>						
    									
    				<option value="6" >6</option>						
    									
    				<option value="7" >7</option>						
    									
    				<option value="8" >8</option>						
    									
    				<option value="9" >9</option>						
    									
    				<option value="10" >10</option>						
    									
    				<option value="11" >11</option>						
    									
    				<option value="12" >12</option>						
    									
    				<option value="13" >13</option>						
    									
    				<option value="14" >14</option>						
    									
    				<option value="15" >15</option>						
    									
    				<option value="16" >16</option>						
    									
    				<option value="17" >17</option>						
    									
    				<option value="18" >18</option>						
    									
    				<option value="19" >19</option>						
    									
    				<option value="20" >20</option>						
    									
    				<option value="21" >21</option>						
    									
    				<option value="22" >22</option>						
    									
    				<option value="23" >23</option>						
    									
    				<option value="24" >24</option>						
    									
    				<option value="25" >25</option>						
    									
    				<option value="26" >26</option>						
    									
    				<option value="27" >27</option>						
    									
    				<option value="28" >28</option>						
    									
    				<option value="29" >29</option>						
    									
    				<option value="30" >30</option>						
    									
    				<option value="31" >31</option>						
    									
    				<option value="32" >32</option>						
    									
    				<option value="33" >33</option>						
    									
    				<option value="34" >34</option>						
    									
    				<option value="35" >35</option>						
    									
    				<option value="36" >36</option>						
    									
    				<option value="37" >37</option>						
    									
    				<option value="38" >38</option>						
    									
    				<option value="39" >39</option>						
    									
    				<option value="40" >40</option>						
    									
    				<option value="41" >41</option>						
    									
    				<option value="42" >42</option>						
    									
    				<option value="43" >43</option>						
    									
    				<option value="44" >44</option>						
    									
    				<option value="45" >45</option>						
    									
    				<option value="46" >46</option>						
    									
    				<option value="47" >47</option>						
    									
    				<option value="48" >48</option>						
    									
    				<option value="49" >49</option>						
    									
    				<option value="50" >50</option>						
    				
    			</select>
    
    			
    			</td>
    			<td  >&nbsp;</td>
    		</tr>			
    		
    		
    			
    		<tr>
    			<td colspan="3">
    			<strong><a href="#">Option:</a></strong><br />
    			
    			
    			
    			
    
    			<table width="100%" border="0" cellspacing="1" cellpadding="1">			
    				
    			
    
    			
    			<tr>
    			<td valign="top">
    
    			<input type="radio" name="ingredientDetailsId" value="387"   disabled="disabled" onChange="swapPrice('&pound;11.99');" /> <span class="smallText"><strong><span class="sale">60 Capsules<span></span> </strong></span></td>
    			
    			</tr>
    				
    			
    
    			
    			<tr>
    			<td valign="top">
    			<input type="radio" name="ingredientDetailsId" value="388"  selected="selected"  onChange="swapPrice('&pound;18.99');" /> <span class="smallText"><strong>270 Capsules </strong></span></td>
    			
    			</tr>
    
    				
    			
    
    			
    			<tr>
    			<td valign="top">
    			<input type="radio" name="ingredientDetailsId" value="1034"   onChange="swapPrice('&pound;100.99');" /> <span class="smallText"><strong>999 </strong></span></td>
    			
    			</tr>
    			
    			</table>
    			</td>
    		</tr>			
    
    			
    			
    
    
    		
    		
    		
    		
    		
    		
    		
    
    
    		<tr>
    
    			<td  colspan="3" align="center"><br />
    			<input type="submit" name="addToBasket" class="button" value="Add To Basket">
    			<input type="hidden" name="mainIngredientId" value="387">
    			
    			<input type="hidden" name="flavourId" value="0">
    			
    			
    			<input type="hidden" name="sweetenerId" value="0">
    					
    			
    			<input type="hidden" name="containerId" value="0">
    									
    			</td>
    			
    		</tr>												
    				
    		</table>	
    PHP:
     
    amaze, Jul 13, 2007 IP
  9. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #9
    amaze, do you have a link to the page holding this form by any chance?
     
    Dan Schulz, Jul 20, 2007 IP