Checked option for radio type input boxes not working.

D

Daniel Rudy

What is the difference between these two code fragments?


This one does not work. The radio button with the checked attribute is
not checked at all.

<table>
<tbody>
<tr>
<td align="center"><input type="radio" name="pwdsel" value="never"
disabled></td>
<td nowrap>Never</td>
<td align="center"><input type="radio" name="pwdsel" value="nextlogin"
disabled></td>
<td nowrap>Next Login</td>
<td align="center"><input type="radio" name="pwdsel" value="normal"
disabled></td>
<td nowrap>Normal</td>
<td align="center"><input type="radio" name="pwdsel" value="date"
checked disabled></td>
<td nowrap>Date</td>
<td><image src="/images/balloon.png" border="0" width="25px"
height="25px" onmousedown="toolTip('Never - Password will never
expire.<br>Next Login - Password will expire on the next
login.<br>Normal - Password will expire after the system configured
duration.<br>Date - Password will expire after the specified
time/date.')" onmouseup="toolTip()" onmouseout="toolTip()"></td>
</tr>
<tr>
<td nowrap colspan="9">
Y:<input type="text" name="pyear" size="4" maxsize="4" value="2008"
disabled>
M:<input type="text" name="pmonth" size="2" maxsize="2" value="08"
disabled>
D:<input type="text" name="pday" size="2" maxsize="2" value="22"
disabled>
H:<input type="text" name="phour" size="2" maxsize="2" value="09"
disabled>
M:<input type="text" name="pmin" size="2" maxsize="2" value="45"
disabled>
<image src="/images/balloon.png" border="0" width="25px"
height="25px" onmousedown="toolTip('Y - Year<br>M - Month<br>D -
Day<br>H - Hour<br>M - Minute')" onmouseup="toolTip()"
onmouseout="toolTip()">
</td>
</tr>
</tbody>
</table>


This one does work. The radio button with the checked attribute does
show as checked.

<table>
<tbody>
<tr>
<td align="center"><input type="radio" name="pwdsel"
value="never"checked disabled></td>
<td nowrap>Never</td>
<td align="center"><input type="radio" name="pwdsel" value="nextlogin"
disabled></td>
<td nowrap>Next Login</td>
<td align="center"><input type="radio" name="pwdsel"
value="normal"disabled></td>
<td nowrap>Normal</td>
<td align="center"><input type="radio" name="pwdsel" value="date"
disabled></td>
<td nowrap>Date</td>
</tr>
<tr>
<td nowrap colspan="8">
Y:<input type="text" name="pyear" size="4" maxsize="4" disabled>
M:<input type="text" name="pmonth" size="2" maxsize="2" disabled>
D:<input type="text" name="pday" size="2" maxsize="2" disabled>
H:<input type="text" name="phour" size="2" maxsize="2" disabled>
M:<input type="text" name="pmin" size="2" maxsize="2" disabled></td>
</tr>
</tbody>
</table>

Any ideas as to what I am doing wrong? This fails in both IE 7 and
Seamonkey.
 
J

Jonathan N. Little

Daniel said:
What is the difference between these two code fragments?


This one does not work. The radio button with the checked attribute is
not checked at all.

<table>
<tbody>
<tr>
<td align="center"><input type="radio" name="pwdsel" value="never"
disabled></td>
<td nowrap>Never</td>
<td align="center"><input type="radio" name="pwdsel" value="nextlogin"
disabled></td>
<td nowrap>Next Login</td>
<td align="center"><input type="radio" name="pwdsel" value="normal"
disabled></td>
<td nowrap>Normal</td>
<td align="center"><input type="radio" name="pwdsel" value="date"
checked disabled></td>

Shows checked for me
Any ideas as to what I am doing wrong?

Not suppling a URL to the actual page in question.


Maybe your browser cached an older version...
 
A

Ari Heino

I think the problem is that multiple inputs have name="pwdsel". If you
remove/change them you'll see both work.
 
H

Harlan Messinger

Ari said:
I think the problem is that multiple inputs have name="pwdsel". If you
remove/change them you'll see both work.

For radio buttons, you're *supposed* to have multiple inputs with the
same name. That's what causes only one of them to be checked at a given
time (that is, what causes the checked one to become unchecked when the
user clicks another one).
 
D

Daniel Rudy

At about the time of 8/22/2008 10:58 AM, Jonathan N. Little stated the
following:
Shows checked for me

What browser are you using?
Not suppling a URL to the actual page in question.

That is not possible. This is on an internal development server that
cannot be accessed from the Internet.
Maybe your browser cached an older version...

That's what I thought too, but that code is from the Show Source command
in Seamonkey.
 
J

Jukka K. Korpela

Daniel said:
What browser are you using?

How about you?
That is not possible. This is on an internal development server that
cannot be accessed from the Internet.

Bullshit. If you want others to help you for free, the least you can do is
to upload a demo page for the problem, if you cannot reveal the real page.

Is the problem that <input type="radio" checked disabled> does not look like
checked? Then _you_ specify the browser(s) in which this happens (and a URL
of a demo).

Or should we guess that your page is somewhere on the spamthis.net domain
since your From field specifies that you are reachable there?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,765
Messages
2,569,568
Members
45,042
Latest member
icassiem

Latest Threads

Top